2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////////////////////////////////////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// written by Christian Daniel                                                   //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//                                                                               //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// 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                  //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//                                                                               //
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// 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  <QInputDialog> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QMessageBox> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QLabel> 
  
						 
					
						
							
								
									
										
										
										
											2016-03-29 10:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QFile> 
  
						 
					
						
							
								
									
										
										
										
											2016-03-29 11:04:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QFileInfo> 
  
						 
					
						
							
								
									
										
										
										
											2016-03-29 10:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QFileDialog> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QTextStream> 
  
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:06:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QDateTime> 
  
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:28:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QSysInfo> 
  
						 
					
						
							
								
									
										
										
										
											2016-03-29 10:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "mainwindow.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ui_mainwindow.h" 
  
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "device/devicesourceapi.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "device/devicesinkapi.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "audio/audiodeviceinfo.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/indicator.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/presetitem.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/addpresetdialog.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/pluginsdialog.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/aboutdialog.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/rollupwidget.h" 
  
						 
					
						
							
								
									
										
										
										
											2015-10-08 02:40:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "gui/channelwindow.h" 
  
						 
					
						
							
								
									
										
										
										
											2016-05-04 17:07:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "gui/audiodialog.h" 
  
						 
					
						
							
								
									
										
										
										
											2016-05-14 14:12:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "gui/samplingdevicecontrol.h" 
  
						 
					
						
							
								
									
										
										
										
											2016-09-28 17:01:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "gui/mypositiondialog.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "dsp/dspengine.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "dsp/spectrumvis.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "dsp/dspcommands.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "plugin/plugingui.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "plugin/pluginapi.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "plugin/plugingui.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-07 03:53:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "gui/glspectrum.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "gui/glspectrumgui.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-28 23:54:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <string> 
  
						 
					
						
							
								
									
										
										
										
											2015-08-09 10:33:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QDebug> 
  
						 
					
						
							
								
									
										
										
										
											2015-06-07 03:30:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								MainWindow : : MainWindow ( QWidget *  parent )  :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QMainWindow ( parent ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ui ( new  Ui : : MainWindow ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-18 16:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_masterTabIndex ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									m_settings ( ) , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-09 04:09:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_dspEngine ( DSPEngine : : instance ( ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-03 18:29:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_lastEngineState ( ( DSPDeviceSourceEngine : : State ) - 1 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_inputGUI ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									m_sampleRate ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_centerFrequency ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-29 22:42:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_sampleFileName ( std : : string ( " ./test.sdriq " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( )  < <  " MainWindow::MainWindow: start " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-09 04:09:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 19:00:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_settings . setAudioDeviceInfo ( & m_audioDeviceInfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 18:56:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ui - > setupUi ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									createStatusBar ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									setCorner ( Qt : : TopLeftCorner ,  Qt : : LeftDockWidgetArea ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									setCorner ( Qt : : BottomLeftCorner ,  Qt : : LeftDockWidgetArea ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									setCorner ( Qt : : TopRightCorner ,  Qt : : RightDockWidgetArea ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									setCorner ( Qt : : BottomRightCorner ,  Qt : : RightDockWidgetArea ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// work around broken Qt dock widget ordering
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 03:15:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    removeDockWidget ( ui - > inputViewDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-02 03:31:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									removeDockWidget ( ui - > inputSelectDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-03 03:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									removeDockWidget ( ui - > spectraDisplayDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									removeDockWidget ( ui - > presetDock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									removeDockWidget ( ui - > channelDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 03:15:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									addDockWidget ( Qt : : LeftDockWidgetArea ,  ui - > inputSelectDock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    addDockWidget ( Qt : : LeftDockWidgetArea ,  ui - > inputViewDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-03 03:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									addDockWidget ( Qt : : LeftDockWidgetArea ,  ui - > spectraDisplayDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									addDockWidget ( Qt : : LeftDockWidgetArea ,  ui - > presetDock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									addDockWidget ( Qt : : RightDockWidgetArea ,  ui - > channelDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-02 03:31:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui - > inputViewDock - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 03:15:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > inputSelectDock - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-03 03:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui - > spectraDisplayDock - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ui - > presetDock - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ui - > channelDock - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 03:15:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > menu_Window - > addAction ( ui - > inputViewDock - > toggleViewAction ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-02 03:31:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui - > menu_Window - > addAction ( ui - > inputSelectDock - > toggleViewAction ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-03 03:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui - > menu_Window - > addAction ( ui - > spectraDisplayDock - > toggleViewAction ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ui - > menu_Window - > addAction ( ui - > presetDock - > toggleViewAction ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ui - > menu_Window - > addAction ( ui - > channelDock - > toggleViewAction ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 10:18:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabInputsView - > setStyleSheet ( " QWidget { background: rgb(50,50,50); }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 04:38:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QToolButton::checked { background: rgb(128,70,0); }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 10:11:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QComboBox::item:selected { color: rgb(255,140,0); }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 10:18:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QTabWidget::pane { border: 1px solid #C06900; }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 10:11:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QTabBar::tab:selected { background: rgb(128,70,0); } " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 10:18:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabInputsSelect - > setStyleSheet ( " QWidget { background: rgb(50,50,50); }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 04:38:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QToolButton::checked { background: rgb(128,70,0); }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 10:11:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QComboBox::item:selected { color: rgb(255,140,0); }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-25 03:19:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QTabWidget::pane { border: 1px solid #808080; }  " 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-25 03:06:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            " QTabBar::tab:selected { background: rgb(100,100,100); } " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 00:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_pluginManager  =  new  PluginManager ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pluginManager - > loadPlugins ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 02:47:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									connect ( & m_inputMessageQueue ,  SIGNAL ( messageEnqueued ( ) ) ,  this ,  SLOT ( handleMessages ( ) ) ,  Qt : : QueuedConnection ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:06:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									connect ( & m_statusTimer ,  SIGNAL ( timeout ( ) ) ,  this ,  SLOT ( updateStatus ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_statusTimer . start ( 1000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 03:33:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_masterTimer . start ( 50 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    qDebug ( )  < <  " MainWindow::MainWindow: add the first device... " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-26 02:03:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    addSourceDevice ( ) ;  // add the first device
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    qDebug ( )  < <  " MainWindow::MainWindow: load settings... " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									loadSettings ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-19 01:02:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( )  < <  " MainWindow::MainWindow: select SampleSource from settings... " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-02 02:22:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  sampleSourceIndex  =  m_settings . getSourceIndex ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-17 23:03:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sampleSourceIndex  =  m_pluginManager - > selectSampleSourceByIndex ( sampleSourceIndex ,  m_deviceUIs . back ( ) - > m_deviceSourceAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( sampleSourceIndex  <  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    qCritical ( " MainWindow::MainWindow: no sample source. Exit " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    exit ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( )  < <  " MainWindow::MainWindow: load current preset settings... " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									loadPresetSettings ( m_settings . getWorkingPreset ( ) ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-19 01:02:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( )  < <  " MainWindow::MainWindow: apply settings... " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									applySettings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( )  < <  " MainWindow::MainWindow: update preset controls... " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									updatePresetControls ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 03:36:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									connect ( ui - > tabInputsView ,  SIGNAL ( currentChanged ( int ) ) ,  this ,  SLOT ( tabInputViewIndexChanged ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    qDebug ( )  < <  " MainWindow::MainWindow: end " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MainWindow : : ~ MainWindow ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    delete  m_pluginManager ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:28:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									delete  m_dateTimeWidget ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									delete  m_showSystemWidget ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									delete  ui ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : addSourceDevice ( )  
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:11:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    DSPDeviceSourceEngine  * dspDeviceSourceEngine  =  m_dspEngine - > addDeviceSourceEngine ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    dspDeviceSourceEngine - > start ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:11:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    uint  dspDeviceSourceEngineUID  =   dspDeviceSourceEngine - > getUID ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 06:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    char  uidCStr [ 16 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    sprintf ( uidCStr ,  " UID:%d " ,  dspDeviceSourceEngineUID ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . push_back ( new  DeviceUISet ( m_masterTimer ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-17 23:03:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_deviceSourceEngine  =  dspDeviceSourceEngine ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 06:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    int  deviceTabIndex  =  m_deviceUIs . size ( ) - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    char  tabNameCStr [ 16 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    sprintf ( tabNameCStr ,  " R%d " ,  deviceTabIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    DeviceSourceAPI  * deviceSourceAPI  =  new  DeviceSourceAPI ( this ,  deviceTabIndex ,  dspDeviceSourceEngine ,  m_deviceUIs . back ( ) - > m_spectrum ,  m_deviceUIs . back ( ) - > m_channelWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-17 23:03:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_deviceSourceAPI  =  deviceSourceAPI ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_samplingDeviceControl - > setDeviceAPI ( deviceSourceAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_samplingDeviceControl - > setPluginManager ( m_pluginManager ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_pluginManager - > populateRxChannelComboBox ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getChannelSelector ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 22:05:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    connect ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getAddChannelButton ( ) ,  SIGNAL ( clicked ( bool ) ) ,  this ,  SLOT ( on_channel_addClicked ( bool ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 18:12:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:11:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    dspDeviceSourceEngine - > addSink ( m_deviceUIs . back ( ) - > m_spectrumVis ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabSpectra - > addTab ( m_deviceUIs . back ( ) - > m_spectrum ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabSpectraGUI - > addTab ( m_deviceUIs . back ( ) - > m_spectrumGUI ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabChannels - > addTab ( m_deviceUIs . back ( ) - > m_channelWindow ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 14:12:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    bool  sampleSourceSignalsBlocked  =  m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelector ( ) - > blockSignals ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 01:11:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_pluginManager - > duplicateLocalSampleSourceDevices ( dspDeviceSourceEngineUID ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pluginManager - > fillSampleSourceSelector ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelector ( ) ,  dspDeviceSourceEngineUID ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 14:21:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelectionConfirm ( ) ,  SIGNAL ( clicked ( bool ) ) ,  this ,  SLOT ( on_sampleSource_confirmClicked ( bool ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 14:12:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelector ( ) - > blockSignals ( sampleSourceSignalsBlocked ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabInputsSelect - > addTab ( m_deviceUIs . back ( ) - > m_samplingDeviceControl ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 06:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabInputsSelect - > setTabToolTip ( deviceTabIndex ,  QString ( uidCStr ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 03:41:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-17 23:03:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    int  sampleSourceIndex  =  m_pluginManager - > selectSampleSourceBySerialOrSequence ( " sdrangel.samplesource.filesource " ,  " 0 " ,  0 ,  m_deviceUIs . back ( ) - > m_deviceSourceAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : addSinkDevice ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    DSPDeviceSinkEngine  * dspDeviceSinkEngine  =  m_dspEngine - > addDeviceSinkEngine ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    dspDeviceSinkEngine - > start ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    uint  dspDeviceSinkEngineUID  =   dspDeviceSinkEngine - > getUID ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 06:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    char  uidCStr [ 16 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    sprintf ( uidCStr ,  " UID:%d " ,  dspDeviceSinkEngineUID ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . push_back ( new  DeviceUISet ( m_masterTimer ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_deviceSourceEngine  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_deviceSinkEngine  =  dspDeviceSinkEngine ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 06:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    int  deviceTabIndex  =  m_deviceUIs . size ( ) - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    char  tabNameCStr [ 16 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    sprintf ( tabNameCStr ,  " T%d " ,  deviceTabIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    DeviceSinkAPI  * deviceSinkAPI  =  new  DeviceSinkAPI ( this ,  deviceTabIndex ,  dspDeviceSinkEngine ,  m_deviceUIs . back ( ) - > m_spectrum ,  m_deviceUIs . back ( ) - > m_channelWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_deviceSourceAPI  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_deviceSinkAPI  =  deviceSinkAPI ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_samplingDeviceControl - > setDeviceAPI ( deviceSinkAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_samplingDeviceControl - > setPluginManager ( m_pluginManager ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pluginManager - > populateTxChannelComboBox ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getChannelSelector ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getAddChannelButton ( ) ,  SIGNAL ( clicked ( bool ) ) ,  this ,  SLOT ( on_channel_addClicked ( bool ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-24 18:06:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    dspDeviceSinkEngine - > addSpectrumSink ( m_deviceUIs . back ( ) - > m_spectrumVis ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabSpectra - > addTab ( m_deviceUIs . back ( ) - > m_spectrum ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabSpectraGUI - > addTab ( m_deviceUIs . back ( ) - > m_spectrumGUI ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabChannels - > addTab ( m_deviceUIs . back ( ) - > m_channelWindow ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  sampleSourceSignalsBlocked  =  m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelector ( ) - > blockSignals ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pluginManager - > duplicateLocalSampleSinkDevices ( dspDeviceSinkEngineUID ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pluginManager - > fillSampleSinkSelector ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelector ( ) ,  dspDeviceSinkEngineUID ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelectionConfirm ( ) ,  SIGNAL ( clicked ( bool ) ) ,  this ,  SLOT ( on_sampleSink_confirmClicked ( bool ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deviceUIs . back ( ) - > m_samplingDeviceControl - > getDeviceSelector ( ) - > blockSignals ( sampleSourceSignalsBlocked ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabInputsSelect - > addTab ( m_deviceUIs . back ( ) - > m_samplingDeviceControl ,  tabNameCStr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 06:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabInputsSelect - > setTabToolTip ( deviceTabIndex ,  QString ( uidCStr ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    int  sampleSinkIndex  =  m_pluginManager - > selectSampleSinkBySerialOrSequence ( " sdrangel.samplesink.filesink " ,  " 0 " ,  0 ,  m_deviceUIs . back ( ) - > m_deviceSinkAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : removeLastDevice ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( m_deviceUIs . back ( ) - > m_deviceSourceEngine )  // source tab
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    DSPDeviceSourceEngine  * lastDeviceEngine  =  m_deviceUIs . back ( ) - > m_deviceSourceEngine ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    lastDeviceEngine - > stopAcquistion ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    lastDeviceEngine - > removeSink ( m_deviceUIs . back ( ) - > m_spectrumVis ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    ui - > tabSpectraGUI - > removeTab ( ui - > tabSpectraGUI - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    ui - > tabSpectra - > removeTab ( ui - > tabSpectra - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    m_deviceUIs . back ( ) - > m_deviceSourceAPI - > freeAll ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_deviceUIs . back ( ) - > m_deviceSourceAPI - > clearBuddiesLists ( ) ;  // remove old API from buddies lists
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 21:51:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    ui - > tabChannels - > removeTab ( ui - > tabChannels - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-16 21:51:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    ui - > tabInputsSelect - > removeTab ( ui - > tabInputsSelect - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-12 01:24:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    m_deviceWidgetTabs . removeLast ( ) ; m_pluginManager - > loadPlugins ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    ui - > tabInputsView - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-18 11:32:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    for  ( int  i  =  0 ;  i  <  m_deviceWidgetTabs . size ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									        qDebug ( " MainWindow::removeLastDevice: adding back tab for %s " ,  m_deviceWidgetTabs [ i ] . displayName . toStdString ( ) . c_str ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									        ui - > tabInputsView - > addTab ( m_deviceWidgetTabs [ i ] . gui ,  m_deviceWidgetTabs [ i ] . tabName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									        ui - > tabInputsView - > setTabToolTip ( i ,  m_deviceWidgetTabs [ i ] . displayName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    delete  m_deviceUIs . back ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    lastDeviceEngine - > stop ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    m_dspEngine - > removeLastDeviceSourceEngine ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( m_deviceUIs . back ( ) - > m_deviceSinkEngine )  // sink tab
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    DSPDeviceSinkEngine  * lastDeviceEngine  =  m_deviceUIs . back ( ) - > m_deviceSinkEngine ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    lastDeviceEngine - > stopGeneration ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-24 18:06:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    lastDeviceEngine - > removeSpectrumSink ( m_deviceUIs . back ( ) - > m_spectrumVis ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    ui - > tabSpectraGUI - > removeTab ( ui - > tabSpectraGUI - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    ui - > tabSpectra - > removeTab ( ui - > tabSpectra - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    m_deviceUIs . back ( ) - > m_deviceSinkAPI - > freeAll ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_deviceUIs . back ( ) - > m_deviceSinkAPI - > clearBuddiesLists ( ) ;  // remove old API from buddies lists
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-18 11:32:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    ui - > tabChannels - > removeTab ( ui - > tabChannels - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    ui - > tabInputsSelect - > removeTab ( ui - > tabInputsSelect - > count ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    m_deviceWidgetTabs . removeLast ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    ui - > tabInputsView - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    for  ( int  i  =  0 ;  i  <  m_deviceWidgetTabs . size ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									        qDebug ( " MainWindow::removeLastDevice: adding back tab for %s " ,  m_deviceWidgetTabs [ i ] . displayName . toStdString ( ) . c_str ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									        ui - > tabInputsView - > addTab ( m_deviceWidgetTabs [ i ] . gui ,  m_deviceWidgetTabs [ i ] . tabName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									        ui - > tabInputsView - > setTabToolTip ( i ,  m_deviceWidgetTabs [ i ] . displayName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    delete  m_deviceUIs . back ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    lastDeviceEngine - > stop ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    m_dspEngine - > removeLastDeviceSinkEngine ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 00:04:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deviceUIs . pop_back ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 09:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 11:26:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : addChannelRollup ( int  deviceTabIndex ,  QWidget *  widget )  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-15 11:26:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( deviceTabIndex  <  ui - > tabInputsView - > count ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        DeviceUISet  * deviceUI  =  m_deviceUIs [ deviceTabIndex ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_channelWindow - > addRollupWidget ( widget ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ui - > channelDock - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ui - > channelDock - > raise ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : addViewAction ( QAction *  action )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ui - > menu_Window - > addAction ( action ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : setDeviceGUI ( int  deviceTabIndex ,  QWidget *  gui ,  const  QString &  deviceDisplayName ,  bool  sourceDevice )  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-14 00:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    char  tabNameCStr [ 16 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( sourceDevice ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        sprintf ( tabNameCStr ,  " R%d " ,  deviceTabIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        sprintf ( tabNameCStr ,  " T%d " ,  deviceTabIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    qDebug ( " MainWindow::setDeviceGUI: insert %s tab at %d " ,  sourceDevice  ?  " Rx "  :  " Tx " ,  deviceTabIndex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 00:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 03:41:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( deviceTabIndex  <  m_deviceWidgetTabs . size ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 00:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_deviceWidgetTabs [ deviceTabIndex ]  =  { gui ,  deviceDisplayName ,  QString ( tabNameCStr ) } ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 00:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_deviceWidgetTabs . append ( { gui ,  deviceDisplayName ,  QString ( tabNameCStr ) } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 00:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 03:41:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabInputsView - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( int  i  =  0 ;  i  <  m_deviceWidgetTabs . size ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-18 00:03:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " MainWindow::setDeviceGUI: adding tab for %s " ,  m_deviceWidgetTabs [ i ] . displayName . toStdString ( ) . c_str ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 03:41:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        ui - > tabInputsView - > addTab ( m_deviceWidgetTabs [ i ] . gui ,  m_deviceWidgetTabs [ i ] . tabName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ui - > tabInputsView - > setTabToolTip ( i ,  m_deviceWidgetTabs [ i ] . displayName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 11:36:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabInputsView - > setCurrentIndex ( deviceTabIndex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : loadSettings ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2015-08-09 10:33:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( )  < <  " MainWindow::loadSettings " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:24:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-07 03:30:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_settings . load ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-11 18:58:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_settings . sortPresets ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-07 03:30:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for ( int  i  =  0 ;  i  <  m_settings . getPresetCount ( ) ;  + + i ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	addPresetToTree ( m_settings . getPreset ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : loadPresetSettings ( const  Preset *  preset ,  int  tabIndex )  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2015-10-02 02:22:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( " MainWindow::loadPresetSettings: preset [%s | %s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										qPrintable ( preset - > getGroup ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( tabIndex  > =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 15:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        DeviceUISet  * deviceUI  =  m_deviceUIs [ tabIndex ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( deviceUI - > m_deviceSourceEngine )  // source device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            deviceUI - > m_spectrumGUI - > deserialize ( preset - > getSpectrumConfig ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            deviceUI - > m_deviceSourceAPI - > loadSourceSettings ( preset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-26 19:40:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            deviceUI - > m_deviceSourceAPI - > loadChannelSettings ( preset ,  & ( m_pluginManager - > m_pluginAPI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  if  ( deviceUI - > m_deviceSinkEngine )  // sink device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            deviceUI - > m_spectrumGUI - > deserialize ( preset - > getSpectrumConfig ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            deviceUI - > m_deviceSinkAPI - > loadSinkSettings ( preset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-26 19:40:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            deviceUI - > m_deviceSinkAPI - > loadChannelSettings ( preset ,  & ( m_pluginManager - > m_pluginAPI ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 15:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									// has to be last step
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									restoreState ( preset - > getLayout ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : savePresetSettings ( Preset *  preset ,  int  tabIndex )  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2015-10-02 02:22:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( " MainWindow::savePresetSettings: preset [%s | %s] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										qPrintable ( preset - > getGroup ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										qPrintable ( preset - > getDescription ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-07 03:30:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 15:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Save from currently selected source tab
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    //int currentSourceTabIndex = ui->tabInputsView->currentIndex();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    DeviceUISet  * deviceUI  =  m_deviceUIs [ tabIndex ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 15:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( deviceUI - > m_deviceSourceEngine )  // source device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        preset - > setSpectrumConfig ( deviceUI - > m_spectrumGUI - > serialize ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        preset - > clearChannels ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSourceAPI - > saveChannelSettings ( preset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSourceAPI - > saveSourceSettings ( preset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  if  ( deviceUI - > m_deviceSinkEngine )  // sink device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        preset - > setSpectrumConfig ( deviceUI - > m_spectrumGUI - > serialize ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        preset - > clearChannels ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:10:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        preset - > setSourcePreset ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSinkAPI - > saveChannelSettings ( preset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSinkAPI - > saveSinkSettings ( preset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-07 03:30:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    preset - > setLayout ( saveState ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : createStatusBar ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-15 04:51:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QString  qtVersionStr  =  QString ( " Qt %1  " ) . arg ( QT_VERSION_STR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 00:16:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# if QT_VERSION >= 0x050400 
  
						 
					
						
							
								
									
										
										
										
											2017-03-20 03:35:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_showSystemWidget  =  new  QLabel ( " SDRangel v3.3.2  "  +  qtVersionStr  +  QSysInfo : : prettyProductName ( ) ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 00:16:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# else 
  
						 
					
						
							
								
									
										
										
										
											2017-03-20 03:35:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_showSystemWidget  =  new  QLabel ( " SDRangel v3.3.2  "  +  qtVersionStr ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 00:16:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:28:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    statusBar ( ) - > addPermanentWidget ( m_showSystemWidget ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:06:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_dateTimeWidget  =  new  QLabel ( tr ( " Date " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_dateTimeWidget - > setToolTip ( tr ( " Current date/time " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									statusBar ( ) - > addPermanentWidget ( m_dateTimeWidget ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : closeEvent ( QCloseEvent * )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : updatePresetControls ( )  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ui - > presetTree - > resizeColumnToContents ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ui - > presetTree - > currentItem ( )  ! =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										ui - > presetDelete - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ui - > presetLoad - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										ui - > presetDelete - > setEnabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ui - > presetLoad - > setEnabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								QTreeWidgetItem *  MainWindow : : addPresetToTree ( const  Preset *  preset )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									QTreeWidgetItem *  group  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-09 01:50:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( int  i  =  0 ;  i  <  ui - > presetTree - > topLevelItemCount ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ui - > presetTree - > topLevelItem ( i ) - > text ( 0 )  = =  preset - > getGroup ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											group  =  ui - > presetTree - > topLevelItem ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-09 01:50:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( group  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										QStringList  sl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sl . append ( preset - > getGroup ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										group  =  new  QTreeWidgetItem ( ui - > presetTree ,  sl ,  PGroup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										group - > setFirstColumnSpanned ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										group - > setExpanded ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ui - > presetTree - > sortByColumn ( 0 ,  Qt : : AscendingOrder ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-09 01:50:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									QStringList  sl ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 02:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sl . append ( QString ( " %1 " ) . arg ( preset - > getCenterFrequency ( )  /  1e6 f ,  0 ,  ' f ' ,  3 ) ) ;  // frequency column
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sl . append ( QString ( " %1 " ) . arg ( preset - > isSourcePreset ( )  ?  ' R '  :  ' T ' ) ) ;            // mode column
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sl . append ( preset - > getDescription ( ) ) ;                                           // description column
 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									PresetItem *  item  =  new  PresetItem ( group ,  sl ,  preset - > getCenterFrequency ( ) ,  PItem ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									item - > setTextAlignment ( 0 ,  Qt : : AlignRight ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									item - > setData ( 0 ,  Qt : : UserRole ,  qVariantFromValue ( preset ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 02:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui - > presetTree - > resizeColumnToContents ( 0 ) ;  // Resize frequency column to minimum
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > presetTree - > resizeColumnToContents ( 1 ) ;  // Resize mode column to minimum
 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									updatePresetControls ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : applySettings ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-09 04:09:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : handleMessages ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Message *  message ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-30 23:22:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( ( message  =  m_inputMessageQueue . pop ( ) )  ! =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-09 04:09:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 10:31:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										qDebug ( " MainWindow::handleMessages: message: %s " ,  message - > getIdentifier ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 15:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										delete  message ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_action_View_Fullscreen_toggled ( bool  checked )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( checked ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										showFullScreen ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  showNormal ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_presetSave_clicked ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QStringList  groups ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QString  group ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									QString  description  =  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for ( int  i  =  0 ;  i  <  ui - > presetTree - > topLevelItemCount ( ) ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										groups . append ( ui - > presetTree - > topLevelItem ( i ) - > text ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QTreeWidgetItem *  item  =  ui - > presetTree - > currentItem ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( item  ! =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if ( item - > type ( )  = =  PGroup ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											group  =  item - > text ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  if ( item - > type ( )  = =  PItem )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											group  =  item - > parent ( ) - > text ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											description  =  item - > text ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									AddPresetDialog  dlg ( groups ,  group ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( description . length ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dlg . setDescription ( description ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if ( dlg . exec ( )  = =  QDialog : : Accepted )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Preset *  preset  =  m_settings . newPreset ( dlg . group ( ) ,  dlg . description ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										savePresetSettings ( preset ,  ui - > tabInputsView - > currentIndex ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ui - > presetTree - > setCurrentItem ( addPresetToTree ( preset ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_presetUpdate_clicked ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QTreeWidgetItem *  item  =  ui - > presetTree - > currentItem ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 17:07:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( item  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( item - > type ( )  = =  PItem )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Preset *  preset  =  qvariant_cast < const  Preset * > ( item - > data ( 0 ,  Qt : : UserRole ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( preset  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Preset *  preset_mod  =  const_cast < Preset * > ( preset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												savePresetSettings ( preset_mod ,  ui - > tabInputsView - > currentIndex ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-29 10:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_presetExport_clicked ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QTreeWidgetItem *  item  =  ui - > presetTree - > currentItem ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( item  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( item - > type ( )  = =  PItem ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Preset *  preset  =  qvariant_cast < const  Preset * > ( item - > data ( 0 ,  Qt : : UserRole ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											QString  base64Str  =  preset - > serialize ( ) . toBase64 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											QString  fileName  =  QFileDialog : : getSaveFileName ( this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											    tr ( " Open preset export file " ) ,  " . " ,  tr ( " Preset export files (*.prex) " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( fileName  ! =  " " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-29 11:04:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												QFileInfo  fileInfo ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( fileInfo . suffix ( )  ! =  " prex " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													fileName  + =  " .prex " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-29 10:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												QFile  exportFile ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( exportFile . open ( QIODevice : : WriteOnly  |  QIODevice : : Text ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													QTextStream  outstream ( & exportFile ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													outstream  < <  base64Str ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													exportFile . close ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											    	QMessageBox : : information ( this ,  tr ( " Message " ) ,  tr ( " Cannot open file for writing " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_presetImport_clicked ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QTreeWidgetItem *  item  =  ui - > presetTree - > currentItem ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( item  ! =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										QString  group ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( item - > type ( )  = =  PGroup ) 	{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											group  =  item - > text ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( item - > type ( )  = =  PItem )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											group  =  item - > parent ( ) - > text ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										QString  fileName  =  QFileDialog : : getOpenFileName ( this , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    tr ( " Open preset export file " ) ,  " . " ,  tr ( " Preset export files (*.prex) " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( fileName  ! =  " " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											QFile  exportFile ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( exportFile . open ( QIODevice : : ReadOnly  |  QIODevice : : Text ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												QByteArray  base64Str ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												QTextStream  instream ( & exportFile ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												instream  > >  base64Str ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												exportFile . close ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-29 14:51:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Preset *  preset  =  m_settings . newPreset ( " " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-29 10:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												preset - > deserialize ( QByteArray : : fromBase64 ( base64Str ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-29 14:51:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												preset - > setGroup ( group ) ;  // override with current group
 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-29 10:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ui - > presetTree - > setCurrentItem ( addPresetToTree ( preset ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												QMessageBox : : information ( this ,  tr ( " Message " ) ,  tr ( " Cannot open file for reading " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-03 02:14:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_settingsSave_clicked ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    savePresetSettings ( m_settings . getWorkingPreset ( ) ,  ui - > tabInputsView - > currentIndex ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_settings . save ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-03 02:14:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_presetLoad_clicked ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2015-08-13 08:51:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									qDebug ( )  < <  " MainWindow::on_presetLoad_clicked " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									QTreeWidgetItem *  item  =  ui - > presetTree - > currentItem ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 02:06:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( item  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-02 04:04:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										qDebug ( " MainWindow::on_presetLoad_clicked: item null " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										updatePresetControls ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 02:06:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-02 04:04:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Preset *  preset  =  qvariant_cast < const  Preset * > ( item - > data ( 0 ,  Qt : : UserRole ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 02:06:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( preset  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-02 04:04:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										qDebug ( " MainWindow::on_presetLoad_clicked: preset null " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									loadPresetSettings ( preset ,  ui - > tabInputsView - > currentIndex ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									applySettings ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_presetDelete_clicked ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QTreeWidgetItem *  item  =  ui - > presetTree - > currentItem ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( item  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										updatePresetControls ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Preset *  preset  =  qvariant_cast < const  Preset * > ( item - > data ( 0 ,  Qt : : UserRole ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-09 10:51:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( preset  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( QMessageBox : : question ( this ,  tr ( " Delete Preset " ) ,  tr ( " Do you want to delete preset '%1'? " ) . arg ( preset - > getDescription ( ) ) ,  QMessageBox : : No  |  QMessageBox : : Yes ,  QMessageBox : : No )  = =  QMessageBox : : Yes )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										delete  item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										m_settings . deletePreset ( preset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_presetTree_currentItemChanged ( QTreeWidgetItem  * current ,  QTreeWidgetItem  * previous )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2015-08-24 00:51:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									updatePresetControls ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_presetTree_itemActivated ( QTreeWidgetItem  * item ,  int  column )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									on_presetLoad_clicked ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-18 00:42:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_Loaded_Plugins_triggered ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PluginsDialog  pluginsDialog ( m_pluginManager ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    pluginsDialog . exec ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 17:07:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_Audio_triggered ( )  
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2017-01-06 19:00:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AudioDialog  audioDialog ( & m_audioDeviceInfo ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 17:07:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									audioDialog . exec ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 19:00:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_dspEngine - > setAudioInputVolume ( m_audioDeviceInfo . getInputVolume ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_dspEngine - > setAudioInputDeviceIndex ( m_audioDeviceInfo . getInputDeviceIndex ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_dspEngine - > setAudioOutputDeviceIndex ( m_audioDeviceInfo . getOutputDeviceIndex ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-28 17:01:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_My_Position_triggered ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MyPositionDialog  myPositionDialog ( m_settings ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									myPositionDialog . exec ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-08 06:00:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_DV_Serial_triggered ( bool  checked )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_dspEngine - > setDVSerialSupport ( checked ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-09 18:17:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( checked ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        std : : vector < std : : string >  deviceNames ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_dspEngine - > getDVSerialNames ( deviceNames ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( deviceNames . size ( )  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            QMessageBox : : information ( this ,  tr ( " Message " ) ,  tr ( " No DV serial devices found " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            std : : vector < std : : string > : : iterator  it  =  deviceNames . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            std : : string  deviceNamesStr  =  " DV Serial devices found:  " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            while  ( it  ! =  deviceNames . end ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( it  ! =  deviceNames . begin ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    deviceNamesStr  + =  " , " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                deviceNamesStr  + =  * it ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                + + it ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            QMessageBox : : information ( this ,  tr ( " Message " ) ,  tr ( deviceNamesStr . c_str ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-08 06:00:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 14:21:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_sampleSource_confirmClicked ( bool  checked )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Do it in the currently selected source tab
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    int  currentSourceTabIndex  =  ui - > tabInputsSelect - > currentIndex ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( currentSourceTabIndex  > =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( " MainWindow::on_sampleSource_confirmClicked: tab at %d " ,  currentSourceTabIndex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-17 14:21:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        DeviceUISet  * deviceUI  =  m_deviceUIs [ currentSourceTabIndex ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSourceAPI - > saveSourceSettings ( m_settings . getWorkingPreset ( ) ) ;  // save old API settings
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 00:21:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        int  selectedComboIndex  =  deviceUI - > m_samplingDeviceControl - > getDeviceSelector ( ) - > currentIndex ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        void  * devicePtr  =  deviceUI - > m_samplingDeviceControl - > getDeviceSelector ( ) - > itemData ( selectedComboIndex ) . value < void  * > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSourceAPI - > stopAcquisition ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSourceAPI - > clearBuddiesLists ( ) ;  // clear old API buddies lists
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_pluginManager - > selectSampleSourceByDevice ( devicePtr ,  deviceUI - > m_deviceSourceAPI ) ;  // sets the new API
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSourceAPI - > loadSourceSettings ( m_settings . getWorkingPreset ( ) ) ;  // load new API settings
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // add to buddies list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        std : : vector < DeviceUISet * > : : iterator  it  =  m_deviceUIs . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        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_deviceSourceAPI - > getHardwareId ( )  = =  ( * it ) - > m_deviceSourceAPI - > getHardwareId ( ) )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( deviceUI - > m_deviceSourceAPI - > getSampleSourceSerial ( )  = =  ( * it ) - > m_deviceSourceAPI - > getSampleSourceSerial ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( * it ) - > m_deviceSourceAPI - > addSourceBuddy ( deviceUI - > m_deviceSourceAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( ( * it ) - > m_deviceSinkEngine )  // it is a sink device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    if  ( ( deviceUI - > m_deviceSourceAPI - > getHardwareId ( )  = =  ( * it ) - > m_deviceSinkAPI - > getHardwareId ( ) )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( deviceUI - > m_deviceSourceAPI - > getSampleSourceSerial ( )  = =  ( * it ) - > m_deviceSinkAPI - > getSampleSinkSerial ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( * it ) - > m_deviceSinkAPI - > addSourceBuddy ( deviceUI - > m_deviceSourceAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( currentSourceTabIndex  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            m_settings . setSourceIndex ( deviceUI - > m_samplingDeviceControl - > getDeviceSelector ( ) - > currentIndex ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 15:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_sampleSink_confirmClicked ( bool  checked )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Do it in the currently selected source tab
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    int  currentSinkTabIndex  =  ui - > tabInputsSelect - > currentIndex ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( currentSinkTabIndex  > =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( " MainWindow::on_sampleSink_confirmClicked: tab at %d " ,  currentSinkTabIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        DeviceUISet  * deviceUI  =  m_deviceUIs [ currentSinkTabIndex ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSinkAPI - > saveSinkSettings ( m_settings . getWorkingPreset ( ) ) ;  // save old API settings
 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        int  selectedComboIndex  =  deviceUI - > m_samplingDeviceControl - > getDeviceSelector ( ) - > currentIndex ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        void  * devicePtr  =  deviceUI - > m_samplingDeviceControl - > getDeviceSelector ( ) - > itemData ( selectedComboIndex ) . value < void  * > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 19:26:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSinkAPI - > stopGeneration ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSinkAPI - > clearBuddiesLists ( ) ;  // remove old API from buddies lists
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_pluginManager - > selectSampleSinkByDevice ( devicePtr ,  deviceUI - > m_deviceSinkAPI ) ;  // sets the new API
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        deviceUI - > m_deviceSinkAPI - > loadSinkSettings ( m_settings . getWorkingPreset ( ) ) ;  // load new API settings
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // add to buddies list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        std : : vector < DeviceUISet * > : : iterator  it  =  m_deviceUIs . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( ;  it  ! =  m_deviceUIs . end ( ) ;  + + it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( * it  ! =  deviceUI )  // do not add to itself
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( ( * it ) - > m_deviceSourceEngine )  // it is a source device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-02 20:24:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    if  ( ( deviceUI - > m_deviceSinkAPI - > getHardwareId ( )  = =  ( * it ) - > m_deviceSourceAPI - > getHardwareId ( ) )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( deviceUI - > m_deviceSinkAPI - > getSampleSinkSerial ( )  = =  ( * it ) - > m_deviceSourceAPI - > getSampleSourceSerial ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( * it ) - > m_deviceSourceAPI - > addSinkBuddy ( deviceUI - > m_deviceSinkAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( ( * it ) - > m_deviceSinkEngine )  // it is a sink device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-02 20:24:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    if  ( ( deviceUI - > m_deviceSinkAPI - > getHardwareId ( )  = =  ( * it ) - > m_deviceSinkAPI - > getHardwareId ( ) )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( deviceUI - > m_deviceSinkAPI - > getSampleSinkSerial ( )  = =  ( * it ) - > m_deviceSinkAPI - > getSampleSinkSerial ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-29 12:41:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ( * it ) - > m_deviceSinkAPI - > addSinkBuddy ( deviceUI - > m_deviceSinkAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_channel_addClicked ( bool  checked )  
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Do it in the currently selected source tab
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    int  currentSourceTabIndex  =  ui - > tabInputsSelect - > currentIndex ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( currentSourceTabIndex  > =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        DeviceUISet  * deviceUI  =  m_deviceUIs [ currentSourceTabIndex ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( deviceUI - > m_deviceSourceEngine )  // source device => Rx channels
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            m_pluginManager - > createRxChannelInstance ( deviceUI - > m_samplingDeviceControl - > getChannelSelector ( ) - > currentIndex ( ) ,  deviceUI - > m_deviceSourceAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  if  ( deviceUI - > m_deviceSinkEngine )  // sink device => Tx channels
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-26 15:26:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            uint32_t  nbSources  =  deviceUI - > m_deviceSinkAPI - > getNumberOfSources ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( nbSources  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                QMessageBox : : information ( this ,  tr ( " Message " ) ,  tr ( " %1 channel(s) already in use. Multiple transmission channels is experimental. You may experience performance problems " ) . arg ( nbSources ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            m_pluginManager - > createTxChannelInstance ( deviceUI - > m_samplingDeviceControl - > getChannelSelector ( ) - > currentIndex ( ) ,  deviceUI - > m_deviceSinkAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-18 16:52:39 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  MainWindow : : on_action_About_triggered ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									AboutDialog  dlg ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dlg . exec ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2015-10-07 09:27:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_addSourceDevice_triggered ( )  
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    addSourceDevice ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 16:57:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_addSinkDevice_triggered ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    addSinkDevice ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 02:04:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_removeLastDevice_triggered ( )  
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( m_deviceUIs . size ( )  >  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        removeLastDevice ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-12 01:24:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_reloadDevices_triggered ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // all devices must be stopped
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    std : : vector < DeviceUISet * > : : iterator  it  =  m_deviceUIs . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( ;  it  ! =  m_deviceUIs . end ( ) ;  + + it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ( * it ) - > m_deviceSourceEngine )  // it is a source device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( ( * it ) - > m_deviceSourceEngine - > state ( )  = =  DSPDeviceSourceEngine : : StRunning ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                QMessageBox : : information ( this ,  tr ( " Message " ) ,  tr ( " Stop all devices for reload to take effect " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ( * it ) - > m_deviceSinkEngine )  // it is a sink device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( ( * it ) - > m_deviceSinkEngine - > state ( )  = =  DSPDeviceSinkEngine : : StRunning ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                QMessageBox : : information ( this ,  tr ( " Message " ) ,  tr ( " Stop all devices for reload to take effect " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // re-scan devices
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pluginManager - > updateSampleSourceDevices ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pluginManager - > updateSampleSinkDevices ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // re-populate device selectors keeping the same selection
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    it  =  m_deviceUIs . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( ;  it  ! =  m_deviceUIs . end ( ) ;  + + it ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ( * it ) - > m_deviceSourceEngine )  // it is a source device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            QComboBox  * deviceSelectorComboBox  =  ( * it ) - > m_samplingDeviceControl - > getDeviceSelector ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            bool  sampleSourceSignalsBlocked  =  deviceSelectorComboBox - > blockSignals ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            m_pluginManager - > fillSampleSourceSelector ( deviceSelectorComboBox ,  ( * it ) - > m_deviceSourceEngine - > getUID ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  newIndex  =  m_pluginManager - > getSampleSourceSelectorIndex ( deviceSelectorComboBox ,  ( * it ) - > m_deviceSourceAPI ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            deviceSelectorComboBox - > setCurrentIndex ( newIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            deviceSelectorComboBox - > blockSignals ( sampleSourceSignalsBlocked ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ( * it ) - > m_deviceSinkEngine )  // it is a sink device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            QComboBox  * deviceSelectorComboBox  =  ( * it ) - > m_samplingDeviceControl - > getDeviceSelector ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            bool  sampleSinkSignalsBlocked  =  deviceSelectorComboBox - > blockSignals ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            m_pluginManager - > fillSampleSinkSelector ( deviceSelectorComboBox ,  ( * it ) - > m_deviceSinkEngine - > getUID ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-12 02:01:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            int  newIndex  =  m_pluginManager - > getSampleSinkSelectorIndex ( deviceSelectorComboBox ,  ( * it ) - > m_deviceSinkAPI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-12 01:24:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            deviceSelectorComboBox - > setCurrentIndex ( newIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            deviceSelectorComboBox - > blockSignals ( sampleSinkSignalsBlocked ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-20 22:14:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : on_action_Exit_triggered ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-24 22:55:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    savePresetSettings ( m_settings . getWorkingPreset ( ) ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_settings . save ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-20 22:14:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    while  ( m_deviceUIs . size ( )  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        removeLastDevice ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 03:36:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : tabInputViewIndexChanged ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    int  inputViewIndex  =  ui - > tabInputsView - > currentIndex ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-20 10:35:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ( inputViewIndex  > =  0 )  & &  ( m_masterTabIndex  > =  0 )  & &  ( inputViewIndex  ! =  m_masterTabIndex ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-18 16:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        DeviceUISet  * deviceUI  =  m_deviceUIs [ inputViewIndex ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        DeviceUISet  * lastdeviceUI  =  m_deviceUIs [ m_masterTabIndex ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-20 10:35:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        lastdeviceUI - > m_mainWindowState  =  saveState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        restoreState ( deviceUI - > m_mainWindowState ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-18 16:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_masterTabIndex  =  inputViewIndex ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 03:36:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ui - > tabSpectra - > setCurrentIndex ( inputViewIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabChannels - > setCurrentIndex ( inputViewIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabInputsSelect - > setCurrentIndex ( inputViewIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ui - > tabSpectraGUI - > setCurrentIndex ( inputViewIndex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:06:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  MainWindow : : updateStatus ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:42:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_dateTimeWidget - > setText ( QDateTime : : currentDateTime ( ) . toString ( " yyyy-MM-dd hh:mm:ss t " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 19:06:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-07 09:27:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								MainWindow : : DeviceUISet : : DeviceUISet ( QTimer &  timer )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_spectrum  =  new  GLSpectrum ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_spectrumVis  =  new  SpectrumVis ( m_spectrum ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_spectrum - > connectTimer ( timer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_spectrumGUI  =  new  GLSpectrumGUI ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_spectrumGUI - > setBuddies ( m_spectrumVis - > getInputMessageQueue ( ) ,  m_spectrumVis ,  m_spectrum ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_channelWindow  =  new  ChannelWindow ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-14 14:12:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_samplingDeviceControl  =  new  SamplingDeviceControl ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-17 23:03:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_deviceSourceEngine  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_deviceSourceAPI  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-19 14:28:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									m_deviceSinkEngine  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									m_deviceSinkAPI  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-12 06:13:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// m_spectrum needs to have its font to be set since it cannot be inherited from the main window
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									QFont  font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    font . setFamily ( QStringLiteral ( " Sans Serif " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    font . setPointSize ( 9 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_spectrum - > setFont ( font ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-07 09:27:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MainWindow : : DeviceUISet : : ~ DeviceUISet ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2016-05-14 14:12:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									delete  m_samplingDeviceControl ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-07 09:27:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									delete  m_channelWindow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									delete  m_spectrumGUI ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									delete  m_spectrumVis ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									delete  m_spectrum ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}