| 
									
										
										
										
											2017-10-22 19:12:43 +02: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                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 14:43:33 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef INCLUDE_MAINWINDOW_H
 | 
					
						
							|  |  |  | #define INCLUDE_MAINWINDOW_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QMainWindow>
 | 
					
						
							|  |  |  | #include <QTimer>
 | 
					
						
							|  |  |  | #include <QList>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "settings/mainsettings.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-25 16:08:18 +01:00
										 |  |  | #include "util/message.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | #include "util/messagequeue.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-20 13:49:21 +01:00
										 |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-18 05:06:43 +01:00
										 |  |  | #include "mainparser.h"
 | 
					
						
							| 
									
										
										
										
											2020-10-10 20:08:11 +02:00
										 |  |  | #include "maincore.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | class QLabel; | 
					
						
							|  |  |  | class QTreeWidgetItem; | 
					
						
							|  |  |  | class QDir; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DSPEngine; | 
					
						
							|  |  |  | class DSPDeviceSourceEngine; | 
					
						
							|  |  |  | class DSPDeviceSinkEngine; | 
					
						
							|  |  |  | class Indicator; | 
					
						
							|  |  |  | class GLSpectrumGUI; | 
					
						
							|  |  |  | class PluginAPI; | 
					
						
							| 
									
										
										
										
											2020-10-04 06:16:15 +02:00
										 |  |  | class ChannelGUI; | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | class ChannelMarker; | 
					
						
							|  |  |  | class PluginManager; | 
					
						
							| 
									
										
										
										
											2019-05-08 22:11:53 +02:00
										 |  |  | class DeviceAPI; | 
					
						
							| 
									
										
										
										
											2017-10-24 18:34:39 +02:00
										 |  |  | class DeviceUISet; | 
					
						
							| 
									
										
										
										
											2020-09-20 01:06:34 +02:00
										 |  |  | class FeatureUISet; | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | class PluginInterface; | 
					
						
							|  |  |  | class QWidget; | 
					
						
							| 
									
										
										
										
											2017-11-17 08:52:15 +01:00
										 |  |  | class WebAPIRequestMapper; | 
					
						
							|  |  |  | class WebAPIServer; | 
					
						
							| 
									
										
										
										
											2020-10-11 12:39:30 +02:00
										 |  |  | class WebAPIAdapter; | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | class Preset; | 
					
						
							|  |  |  | class Command; | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | class FeatureSetPreset; | 
					
						
							| 
									
										
										
										
											2018-01-05 05:05:12 +01:00
										 |  |  | class CommandKeyReceiver; | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Ui { | 
					
						
							|  |  |  | 	class MainWindow; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | class SDRGUI_API MainWindow : public QMainWindow { | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2017-11-18 05:06:43 +01:00
										 |  |  | 	explicit MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent = 0); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	~MainWindow(); | 
					
						
							| 
									
										
										
										
											2017-10-24 13:45:10 +02:00
										 |  |  | 	static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference
 | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; } | 
					
						
							|  |  |  | 	void addViewAction(QAction* action); | 
					
						
							| 
									
										
										
										
											2019-05-18 11:59:56 +02:00
										 |  |  | 	void setDeviceGUI(int deviceTabIndex, QWidget* gui, const QString& deviceDisplayName, int deviceType = 0); | 
					
						
							| 
									
										
										
										
											2019-08-01 18:50:21 +02:00
										 |  |  |     const PluginManager *getPluginManager() const { return m_pluginManager; } | 
					
						
							| 
									
										
										
										
											2020-01-21 18:05:14 +01:00
										 |  |  |     std::vector<DeviceUISet*>& getDeviceUISets() { return m_deviceUIs; } | 
					
						
							| 
									
										
										
										
											2019-07-29 18:54:50 +02:00
										 |  |  |     void commandKeysConnect(QObject *object, const char *slot); | 
					
						
							|  |  |  |     void commandKeysDisconnect(QObject *object, const char *slot); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2017-11-25 19:42:56 +01:00
										 |  |  |     enum { | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 		PGroup, | 
					
						
							|  |  |  | 		PItem | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct DeviceWidgetTabData | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 	    QWidget *gui; | 
					
						
							|  |  |  | 	    QString displayName; | 
					
						
							|  |  |  | 	    QString tabName; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-24 13:45:10 +02:00
										 |  |  | 	static MainWindow *m_instance; | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	Ui::MainWindow* ui; | 
					
						
							|  |  |  | 	MessageQueue m_inputMessageQueue; | 
					
						
							| 
									
										
										
										
											2020-10-10 20:08:11 +02:00
										 |  |  |     MainCore *m_mainCore; | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	std::vector<DeviceUISet*> m_deviceUIs; | 
					
						
							| 
									
										
										
										
											2020-09-20 01:06:34 +02:00
										 |  |  |     std::vector<FeatureUISet*> m_featureUIs; | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	QList<DeviceWidgetTabData> m_deviceWidgetTabs; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	DSPEngine* m_dspEngine; | 
					
						
							|  |  |  | 	PluginManager* m_pluginManager; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QTimer m_statusTimer; | 
					
						
							|  |  |  | 	int m_lastEngineState; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QLabel* m_dateTimeWidget; | 
					
						
							|  |  |  | 	QLabel* m_showSystemWidget; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QWidget* m_inputGUI; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int m_sampleRate; | 
					
						
							|  |  |  | 	quint64 m_centerFrequency; | 
					
						
							|  |  |  | 	std::string m_sampleFileName; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-17 08:52:15 +01:00
										 |  |  | 	WebAPIRequestMapper *m_requestMapper; | 
					
						
							|  |  |  | 	WebAPIServer *m_apiServer; | 
					
						
							| 
									
										
										
										
											2020-10-11 12:39:30 +02:00
										 |  |  | 	WebAPIAdapter *m_apiAdapter; | 
					
						
							| 
									
										
										
										
											2018-01-12 00:57:05 +01:00
										 |  |  | 	QString m_apiHost; | 
					
						
							|  |  |  | 	int m_apiPort; | 
					
						
							| 
									
										
										
										
											2017-11-17 08:52:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-05 05:05:12 +01:00
										 |  |  | 	CommandKeyReceiver *m_commandKeyReceiver; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void loadSettings(); | 
					
						
							|  |  |  | 	void loadPresetSettings(const Preset* preset, int tabIndex); | 
					
						
							|  |  |  | 	void savePresetSettings(Preset* preset, int tabIndex); | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 	void loadFeatureSetPresetSettings(const FeatureSetPreset* preset, int featureSetIndex); | 
					
						
							|  |  |  | 	void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex); | 
					
						
							| 
									
										
										
										
											2018-01-05 11:54:05 +01:00
										 |  |  | 	void saveCommandSettings(); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void createStatusBar(); | 
					
						
							|  |  |  | 	void closeEvent(QCloseEvent*); | 
					
						
							|  |  |  | 	void updatePresetControls(); | 
					
						
							|  |  |  | 	QTreeWidgetItem* addPresetToTree(const Preset* preset); | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 	QTreeWidgetItem* addCommandToTree(const Command* command); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void applySettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 09:10:19 +01:00
										 |  |  | 	void addSourceDevice(int deviceIndex); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void addSinkDevice(); | 
					
						
							| 
									
										
										
										
											2020-11-10 12:08:58 +01:00
										 |  |  | 	void addMIMODevice(); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  |     void removeLastDevice(); | 
					
						
							| 
									
										
										
										
											2020-09-20 01:06:34 +02:00
										 |  |  |     void addFeatureSet(); | 
					
						
							| 
									
										
										
										
											2020-11-14 22:08:06 +01:00
										 |  |  |     void removeFeatureSet(unsigned int tabIndex); | 
					
						
							| 
									
										
										
										
											2020-09-20 01:06:34 +02:00
										 |  |  |     void removeAllFeatureSets(); | 
					
						
							| 
									
										
										
										
											2017-12-23 23:41:37 +01:00
										 |  |  |     void deleteChannel(int deviceSetIndex, int channelIndex); | 
					
						
							| 
									
										
										
										
											2020-09-13 17:50:24 +02:00
										 |  |  |     void sampleSourceChanged(int tabIndex, int newDeviceIndex); | 
					
						
							|  |  |  | 	void sampleSinkChanged(int tabIndex, int newDeviceIndex); | 
					
						
							| 
									
										
										
										
											2020-11-10 12:08:58 +01:00
										 |  |  | 	void sampleMIMOChanged(int tabIndex, int newDeviceIndex); | 
					
						
							| 
									
										
										
										
											2020-09-21 03:13:36 +02:00
										 |  |  |     void deleteFeature(int featureSetIndex, int featureIndex); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-25 16:08:18 +01:00
										 |  |  |     bool handleMessage(const Message& cmd); | 
					
						
							| 
									
										
										
										
											2020-11-02 08:29:21 +01:00
										 |  |  | 	void restoreDeviceTabs(); | 
					
						
							| 
									
										
										
										
											2017-11-25 16:08:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | private slots: | 
					
						
							|  |  |  | 	void handleMessages(); | 
					
						
							|  |  |  | 	void updateStatus(); | 
					
						
							|  |  |  | 	void on_action_View_Fullscreen_toggled(bool checked); | 
					
						
							|  |  |  | 	void on_presetSave_clicked(); | 
					
						
							|  |  |  | 	void on_presetUpdate_clicked(); | 
					
						
							| 
									
										
										
										
											2018-01-05 11:45:20 +01:00
										 |  |  |     void on_presetEdit_clicked(); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void on_presetExport_clicked(); | 
					
						
							|  |  |  | 	void on_presetImport_clicked(); | 
					
						
							|  |  |  | 	void on_settingsSave_clicked(); | 
					
						
							|  |  |  | 	void on_presetLoad_clicked(); | 
					
						
							|  |  |  | 	void on_presetDelete_clicked(); | 
					
						
							|  |  |  | 	void on_presetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); | 
					
						
							|  |  |  | 	void on_presetTree_itemActivated(QTreeWidgetItem *item, int column); | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 	void on_commandNew_clicked(); | 
					
						
							|  |  |  |     void on_commandDuplicate_clicked(); | 
					
						
							|  |  |  |     void on_commandEdit_clicked(); | 
					
						
							|  |  |  |     void on_commandDelete_clicked(); | 
					
						
							| 
									
										
										
										
											2018-01-04 20:15:33 +01:00
										 |  |  |     void on_commandRun_clicked(); | 
					
						
							|  |  |  |     void on_commandOutput_clicked(); | 
					
						
							| 
									
										
										
										
											2018-01-05 11:54:05 +01:00
										 |  |  |     void on_commandsSave_clicked(); | 
					
						
							| 
									
										
										
										
											2018-01-05 05:05:12 +01:00
										 |  |  |     void on_commandKeyboardConnect_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void on_action_Audio_triggered(); | 
					
						
							| 
									
										
										
										
											2017-11-11 19:26:23 +01:00
										 |  |  |     void on_action_Logging_triggered(); | 
					
						
							| 
									
										
										
										
											2019-07-19 18:38:03 +02:00
										 |  |  |     void on_action_AMBE_triggered(); | 
					
						
							| 
									
										
										
										
											2020-01-12 01:10:51 +01:00
										 |  |  |     void on_action_LimeRFE_triggered(); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void on_action_My_Position_triggered(); | 
					
						
							| 
									
										
										
										
											2019-06-12 18:50:53 +02:00
										 |  |  |     void on_action_DeviceUserArguments_triggered(); | 
					
						
							| 
									
										
										
										
											2020-09-13 17:50:24 +02:00
										 |  |  |     void samplingDeviceChanged(int deviceType, int tabIndex, int newDeviceIndex); | 
					
						
							| 
									
										
										
										
											2020-09-12 10:37:16 +02:00
										 |  |  |     void channelAddClicked(int channelIndex); | 
					
						
							| 
									
										
										
										
											2020-09-20 01:06:34 +02:00
										 |  |  |     void featureAddClicked(int featureIndex); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void on_action_Loaded_Plugins_triggered(); | 
					
						
							|  |  |  | 	void on_action_About_triggered(); | 
					
						
							|  |  |  | 	void on_action_addSourceDevice_triggered(); | 
					
						
							|  |  |  | 	void on_action_addSinkDevice_triggered(); | 
					
						
							| 
									
										
										
										
											2019-05-18 11:59:56 +02:00
										 |  |  |     void on_action_addMIMODevice_triggered(); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | 	void on_action_removeLastDevice_triggered(); | 
					
						
							|  |  |  | 	void tabInputViewIndexChanged(); | 
					
						
							| 
									
										
										
										
											2020-09-12 10:37:16 +02:00
										 |  |  |     void tabChannelsIndexChanged(); | 
					
						
							| 
									
										
										
										
											2018-01-05 05:05:12 +01:00
										 |  |  | 	void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release); | 
					
						
							| 
									
										
										
										
											2017-10-22 19:12:43 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_MAINWINDOW_H
 |