| 
									
										
										
										
											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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef INCLUDE_MAINWINDOW_H
 | 
					
						
							|  |  |  | #define INCLUDE_MAINWINDOW_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QMainWindow>
 | 
					
						
							|  |  |  | #include <QTimer>
 | 
					
						
							| 
									
										
										
										
											2016-05-17 03:41:01 +02:00
										 |  |  | #include <QList>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-02 02:22:56 +02:00
										 |  |  | #include "settings/mainsettings.h"
 | 
					
						
							| 
									
										
										
										
											2015-08-18 02:47:14 +02:00
										 |  |  | #include "util/messagequeue.h"
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | #include "util/export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QLabel; | 
					
						
							|  |  |  | class QTreeWidgetItem; | 
					
						
							|  |  |  | class QDir; | 
					
						
							| 
									
										
										
										
											2016-05-14 14:12:57 +02:00
										 |  |  | class SamplingDeviceControl; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class AudioDeviceInfo; | 
					
						
							|  |  |  | class DSPEngine; | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | class DSPDeviceSourceEngine; | 
					
						
							| 
									
										
										
										
											2016-10-19 14:28:58 +02:00
										 |  |  | class DSPDeviceSinkEngine; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | class Indicator; | 
					
						
							|  |  |  | class SpectrumVis; | 
					
						
							| 
									
										
										
										
											2015-10-07 03:53:25 +02:00
										 |  |  | class GLSpectrum; | 
					
						
							|  |  |  | class GLSpectrumGUI; | 
					
						
							| 
									
										
										
										
											2015-10-07 09:27:44 +02:00
										 |  |  | class ChannelWindow; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | class PluginAPI; | 
					
						
							| 
									
										
										
										
											2017-09-26 00:22:08 +02:00
										 |  |  | class PluginInstanceGUI; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | class ChannelMarker; | 
					
						
							|  |  |  | class PluginManager; | 
					
						
							| 
									
										
										
										
											2016-10-11 01:17:55 +02:00
										 |  |  | class DeviceSourceAPI; | 
					
						
							| 
									
										
										
										
											2016-10-21 16:57:50 +02:00
										 |  |  | class DeviceSinkAPI; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | class PluginInterface; | 
					
						
							| 
									
										
										
										
											2016-05-17 03:41:01 +02:00
										 |  |  | class QWidget; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Ui { | 
					
						
							|  |  |  | 	class MainWindow; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-30 01:26:51 +02:00
										 |  |  | class SDRANGEL_API MainWindow : public QMainWindow { | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2015-10-07 09:27:44 +02:00
										 |  |  | 	struct DeviceUISet | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		SpectrumVis *m_spectrumVis; | 
					
						
							|  |  |  | 		GLSpectrum *m_spectrum; | 
					
						
							|  |  |  | 		GLSpectrumGUI *m_spectrumGUI; | 
					
						
							|  |  |  | 		ChannelWindow *m_channelWindow; | 
					
						
							| 
									
										
										
										
											2016-05-14 14:12:57 +02:00
										 |  |  | 		SamplingDeviceControl *m_samplingDeviceControl; | 
					
						
							| 
									
										
										
										
											2016-10-17 23:03:47 +02:00
										 |  |  | 		DSPDeviceSourceEngine *m_deviceSourceEngine; | 
					
						
							|  |  |  | 		DeviceSourceAPI *m_deviceSourceAPI; | 
					
						
							| 
									
										
										
										
											2016-10-19 14:28:58 +02:00
										 |  |  | 		DSPDeviceSinkEngine *m_deviceSinkEngine; | 
					
						
							| 
									
										
										
										
											2016-10-21 16:57:50 +02:00
										 |  |  | 		DeviceSinkAPI *m_deviceSinkAPI; | 
					
						
							| 
									
										
										
										
											2016-05-18 16:24:04 +02:00
										 |  |  | 		QByteArray m_mainWindowState; | 
					
						
							| 
									
										
										
										
											2015-10-07 09:27:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		DeviceUISet(QTimer& timer); | 
					
						
							|  |  |  | 		~DeviceUISet(); | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-09 10:51:02 +02:00
										 |  |  | 	explicit MainWindow(QWidget* parent = 0); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	~MainWindow(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-18 02:47:14 +02:00
										 |  |  | 	MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; } | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void addViewAction(QAction* action); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-15 11:26:48 +02:00
										 |  |  |     void addChannelRollup(int deviceTabIndex, QWidget* widget); | 
					
						
							| 
									
										
										
										
											2016-10-18 00:03:51 +02:00
										 |  |  | 	void setDeviceGUI(int deviceTabIndex, QWidget* gui, const QString& deviceDisplayName, bool sourceDevice = true); | 
					
						
							| 
									
										
										
										
											2016-05-15 11:26:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-01 03:33:07 +02:00
										 |  |  | 	const QTimer& getMasterTimer() const { return m_masterTimer; } | 
					
						
							| 
									
										
										
										
											2016-09-28 13:38:38 +02:00
										 |  |  | 	const MainSettings& getMainSettings() const { return m_settings; } | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	enum { | 
					
						
							|  |  |  | 		PGroup, | 
					
						
							|  |  |  | 		PItem | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-17 03:41:01 +02:00
										 |  |  | 	struct DeviceWidgetTabData | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 	    QWidget *gui; | 
					
						
							|  |  |  | 	    QString displayName; | 
					
						
							|  |  |  | 	    QString tabName; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	Ui::MainWindow* ui; | 
					
						
							| 
									
										
										
										
											2017-01-06 19:00:45 +01:00
										 |  |  | 	AudioDeviceInfo m_audioDeviceInfo; | 
					
						
							| 
									
										
										
										
											2015-08-18 02:47:14 +02:00
										 |  |  | 	MessageQueue m_inputMessageQueue; | 
					
						
							| 
									
										
										
										
											2015-10-02 02:22:56 +02:00
										 |  |  | 	MainSettings m_settings; | 
					
						
							| 
									
										
										
										
											2015-10-07 09:27:44 +02:00
										 |  |  | 	std::vector<DeviceUISet*> m_deviceUIs; | 
					
						
							| 
									
										
										
										
											2016-05-17 03:41:01 +02:00
										 |  |  | 	QList<DeviceWidgetTabData> m_deviceWidgetTabs; | 
					
						
							| 
									
										
										
										
											2016-05-18 16:24:04 +02:00
										 |  |  | 	int m_masterTabIndex; | 
					
						
							| 
									
										
										
										
											2015-10-07 03:53:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	DSPEngine* m_dspEngine; | 
					
						
							| 
									
										
										
										
											2016-05-17 00:04:27 +02:00
										 |  |  | 	PluginManager* m_pluginManager; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-01 03:33:07 +02:00
										 |  |  | 	QTimer m_masterTimer; | 
					
						
							| 
									
										
										
										
											2016-05-12 19:06:38 +02:00
										 |  |  | 	QTimer m_statusTimer; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	int m_lastEngineState; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-12 19:06:38 +02:00
										 |  |  | 	QLabel* m_dateTimeWidget; | 
					
						
							| 
									
										
										
										
											2016-05-12 19:28:04 +02:00
										 |  |  | 	QLabel* m_showSystemWidget; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	QWidget* m_inputGUI; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int m_sampleRate; | 
					
						
							|  |  |  | 	quint64 m_centerFrequency; | 
					
						
							| 
									
										
										
										
											2015-07-28 23:54:17 +02:00
										 |  |  | 	std::string m_sampleFileName; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void loadSettings(); | 
					
						
							| 
									
										
										
										
											2016-05-24 22:55:10 +02:00
										 |  |  | 	void loadPresetSettings(const Preset* preset, int tabIndex); | 
					
						
							|  |  |  | 	void savePresetSettings(Preset* preset, int tabIndex); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void createStatusBar(); | 
					
						
							|  |  |  | 	void closeEvent(QCloseEvent*); | 
					
						
							| 
									
										
										
										
											2015-08-24 00:51:27 +02:00
										 |  |  | 	void updatePresetControls(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	QTreeWidgetItem* addPresetToTree(const Preset* preset); | 
					
						
							|  |  |  | 	void applySettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-14 02:04:22 +02:00
										 |  |  | 	void addSourceDevice(); | 
					
						
							| 
									
										
										
										
											2016-10-21 16:57:50 +02:00
										 |  |  | 	void addSinkDevice(); | 
					
						
							| 
									
										
										
										
											2016-05-13 09:23:33 +02:00
										 |  |  |     void removeLastDevice(); | 
					
						
							| 
									
										
										
										
											2016-05-11 19:14:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | private slots: | 
					
						
							|  |  |  | 	void handleMessages(); | 
					
						
							| 
									
										
										
										
											2016-05-12 19:06:38 +02:00
										 |  |  | 	void updateStatus(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	void on_action_View_Fullscreen_toggled(bool checked); | 
					
						
							|  |  |  | 	void on_presetSave_clicked(); | 
					
						
							| 
									
										
										
										
											2015-05-09 10:51:02 +02:00
										 |  |  | 	void on_presetUpdate_clicked(); | 
					
						
							| 
									
										
										
										
											2016-03-29 10:57:50 +02:00
										 |  |  | 	void on_presetExport_clicked(); | 
					
						
							|  |  |  | 	void on_presetImport_clicked(); | 
					
						
							| 
									
										
										
										
											2015-10-03 02:14:26 +02:00
										 |  |  | 	void on_settingsSave_clicked(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	void on_presetLoad_clicked(); | 
					
						
							|  |  |  | 	void on_presetDelete_clicked(); | 
					
						
							|  |  |  | 	void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); | 
					
						
							|  |  |  | 	void on_presetTree_itemActivated(QTreeWidgetItem *item, int column); | 
					
						
							| 
									
										
										
										
											2016-05-04 17:07:26 +02:00
										 |  |  | 	void on_action_Audio_triggered(); | 
					
						
							| 
									
										
										
										
											2016-05-08 06:00:37 +02:00
										 |  |  | 	void on_action_DV_Serial_triggered(bool checked); | 
					
						
							| 
									
										
										
										
											2016-09-28 17:01:57 +02:00
										 |  |  | 	void on_action_My_Position_triggered(); | 
					
						
							| 
									
										
										
										
											2016-05-17 14:21:27 +02:00
										 |  |  | 	void on_sampleSource_confirmClicked(bool checked); | 
					
						
							| 
									
										
										
										
											2016-10-21 16:57:50 +02:00
										 |  |  | 	void on_sampleSink_confirmClicked(bool checked); | 
					
						
							|  |  |  |     void on_channel_addClicked(bool checked); | 
					
						
							| 
									
										
										
										
											2016-05-18 00:42:35 +02:00
										 |  |  | 	void on_action_Loaded_Plugins_triggered(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	void on_action_About_triggered(); | 
					
						
							| 
									
										
										
										
											2016-10-14 02:04:22 +02:00
										 |  |  | 	void on_action_addSourceDevice_triggered(); | 
					
						
							| 
									
										
										
										
											2016-10-21 16:57:50 +02:00
										 |  |  | 	void on_action_addSinkDevice_triggered(); | 
					
						
							| 
									
										
										
										
											2016-10-14 02:04:22 +02:00
										 |  |  | 	void on_action_removeLastDevice_triggered(); | 
					
						
							| 
									
										
										
										
											2017-01-12 01:24:08 +01:00
										 |  |  | 	void on_action_reloadDevices_triggered(); | 
					
						
							| 
									
										
										
										
											2016-05-20 22:14:07 +02:00
										 |  |  | 	void on_action_Exit_triggered(); | 
					
						
							| 
									
										
										
										
											2016-05-14 03:36:28 +02:00
										 |  |  | 	void tabInputViewIndexChanged(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_MAINWINDOW_H
 |