| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2023-11-19 13:31:45 +01:00
										 |  |  | // Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
 | 
					
						
							|  |  |  | // written by Christian Daniel                                                   //
 | 
					
						
							|  |  |  | // Copyright (C) 2015-2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com>    //
 | 
					
						
							|  |  |  | // Copyright (C) 2022-2023 Jon Beniston, M7RCE <jon@beniston.com>                //
 | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							|  |  |  | // (at your option) any later version.                                           //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef INCLUDE_DEVICEGUI_H
 | 
					
						
							|  |  |  | #define INCLUDE_DEVICEGUI_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | #include <QMdiSubWindow>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | #include <QtGlobal>
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							|  |  |  | #include <QByteArray>
 | 
					
						
							|  |  |  | #include <QWidget>
 | 
					
						
							| 
									
										
										
										
											2022-12-20 16:10:11 +00:00
										 |  |  | #include <QLabel>
 | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  | #include "gui/channeladddialog.h"
 | 
					
						
							| 
									
										
										
										
											2022-04-22 18:21:24 +01:00
										 |  |  | #include "gui/framelesswindowresizer.h"
 | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  | #include "settings/serializableinterface.h"
 | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | #include "export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | class QCloseEvent; | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | class Message; | 
					
						
							|  |  |  | class MessageQueue; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | class QPushButton; | 
					
						
							|  |  |  | class QVBoxLayout; | 
					
						
							|  |  |  | class QHBoxLayout; | 
					
						
							|  |  |  | class QSizeGrip; | 
					
						
							| 
									
										
										
										
											2022-05-13 22:24:48 +02:00
										 |  |  | class DeviceUISet; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  | class SDRGUI_API DeviceGUI : public QMdiSubWindow, public SerializableInterface { | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     Q_OBJECT | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     enum DeviceType | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         DeviceRx, | 
					
						
							|  |  |  |         DeviceTx, | 
					
						
							|  |  |  |         DeviceMIMO | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     enum ContextMenuType | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ContextMenuNone, | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |         ContextMenuDeviceSettings | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-07 21:50:42 +02:00
										 |  |  | 	explicit DeviceGUI(QWidget *parent = nullptr); | 
					
						
							|  |  |  | 	~DeviceGUI() override; | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual void resetToDefaults() = 0; | 
					
						
							| 
									
										
										
										
											2022-05-13 22:24:48 +02:00
										 |  |  |     void setWorkspaceIndex(int index); | 
					
						
							| 
									
										
										
										
											2022-04-20 20:08:41 +02:00
										 |  |  |     int getWorkspaceIndex() const { return m_workspaceIndex; } | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual MessageQueue* getInputMessageQueue() = 0; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QWidget *getContents() { return m_contents; } | 
					
						
							| 
									
										
										
										
											2022-11-09 15:53:44 +00:00
										 |  |  |     void sizeToContents(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     void setDeviceType(DeviceType type); | 
					
						
							|  |  |  |     DeviceType getDeviceType() const { return m_deviceType; } | 
					
						
							|  |  |  |     void setTitle(const QString& title); | 
					
						
							|  |  |  |     QString getTitle() const; | 
					
						
							|  |  |  |     void setToolTip(const QString& tooltip); | 
					
						
							|  |  |  |     void setIndex(int index); | 
					
						
							|  |  |  |     int getIndex() const { return m_deviceSetIndex; } | 
					
						
							|  |  |  |     void setCurrentDeviceIndex(int index) { m_currentDeviceIndex = index; } //!< index in plugins list
 | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     void setChannelNames(const QStringList& channelNames) { m_channelAddDialog.addChannelNames(channelNames); } | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  |     DeviceUISet* getDeviceUISet() { return m_deviceUISet; } | 
					
						
							| 
									
										
										
										
											2023-12-06 10:14:01 +00:00
										 |  |  |     virtual void setReplayTime(float time) { (void) time; } //!< Not supported by all devices
 | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							| 
									
										
										
										
											2022-04-22 18:21:24 +01:00
										 |  |  |     void closeEvent(QCloseEvent *event) override; | 
					
						
							|  |  |  |     void leaveEvent(QEvent *event) override; | 
					
						
							|  |  |  |     void mousePressEvent(QMouseEvent* event) override; | 
					
						
							|  |  |  |     void mouseReleaseEvent(QMouseEvent* event) override; | 
					
						
							|  |  |  |     void mouseMoveEvent(QMouseEvent* event) override; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     void resetContextMenuType() { m_contextMenuType = ContextMenuNone; } | 
					
						
							| 
									
										
										
										
											2022-04-26 19:44:14 +02:00
										 |  |  |     int getAdditionalHeight() const { return 22 + 22; } | 
					
						
							| 
									
										
										
										
											2022-12-20 16:10:11 +00:00
										 |  |  |     void setStatus(const QString &status) { m_statusLabel->setText(status); } | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-13 22:24:48 +02:00
										 |  |  |     DeviceUISet* m_deviceUISet; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     DeviceType m_deviceType; | 
					
						
							|  |  |  |     int m_deviceSetIndex; | 
					
						
							| 
									
										
										
										
											2022-04-20 20:08:41 +02:00
										 |  |  |     int m_workspaceIndex; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     QString m_helpURL; | 
					
						
							|  |  |  |     QWidget *m_contents; | 
					
						
							|  |  |  |     ContextMenuType m_contextMenuType; | 
					
						
							| 
									
										
										
										
											2023-11-13 20:51:03 +00:00
										 |  |  |     FramelessWindowResizer m_resizer; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected slots: | 
					
						
							|  |  |  |     void shrinkWindow(); | 
					
						
							| 
									
										
										
										
											2022-11-09 15:53:44 +00:00
										 |  |  |     void maximizeWindow(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     bool isOnMovingPad(); | 
					
						
							|  |  |  |     QString getDeviceTypeColor(); | 
					
						
							|  |  |  |     QString getDeviceTypeTag(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QLabel *m_indexLabel; | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |     QPushButton *m_settingsButton; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     QPushButton *m_changeDeviceButton; | 
					
						
							|  |  |  |     QPushButton *m_reloadDeviceButton; | 
					
						
							|  |  |  |     QPushButton *m_addChannelsButton; | 
					
						
							| 
									
										
										
										
											2022-04-09 13:38:22 +02:00
										 |  |  |     QPushButton *m_deviceSetPresetsButton; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     QLabel *m_titleLabel; | 
					
						
							|  |  |  |     QPushButton *m_helpButton; | 
					
						
							|  |  |  |     QPushButton *m_moveButton; | 
					
						
							|  |  |  |     QPushButton *m_shrinkButton; | 
					
						
							| 
									
										
										
										
											2022-11-09 15:53:44 +00:00
										 |  |  |     QPushButton *m_maximizeButton; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     QPushButton *m_closeButton; | 
					
						
							| 
									
										
										
										
											2022-04-09 13:38:22 +02:00
										 |  |  |     QPushButton *m_showSpectrumButton; | 
					
						
							|  |  |  |     QPushButton *m_showAllChannelsButton; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     QLabel *m_statusLabel; | 
					
						
							|  |  |  |     QVBoxLayout *m_layouts; | 
					
						
							|  |  |  |     QHBoxLayout *m_topLayout; | 
					
						
							| 
									
										
										
										
											2022-12-20 16:10:11 +00:00
										 |  |  |     QVBoxLayout *m_centerLayout; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     QHBoxLayout *m_bottomLayout; | 
					
						
							|  |  |  |     QSizeGrip *m_sizeGripBottomRight; | 
					
						
							|  |  |  |     bool m_drag; | 
					
						
							|  |  |  |     QPoint m_DragPosition; | 
					
						
							|  |  |  |     int m_currentDeviceIndex; //!< Index in device plugins registrations
 | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     ChannelAddDialog m_channelAddDialog; | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							| 
									
										
										
										
											2022-04-17 01:31:50 +02:00
										 |  |  |     void activateSettingsDialog(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     void openChangeDeviceDialog(); | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     void openAddChannelsDialog(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  |     void deviceReload(); | 
					
						
							|  |  |  |     void showHelp(); | 
					
						
							|  |  |  |     void openMoveToWorkspaceDialog(); | 
					
						
							| 
									
										
										
										
											2022-04-10 00:11:23 +02:00
										 |  |  |     void showSpectrumHandler(); | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     void showAllChannelsHandler(); | 
					
						
							| 
									
										
										
										
											2022-04-13 18:43:37 +02:00
										 |  |  |     void deviceSetPresetsDialog(); | 
					
						
							| 
									
										
										
										
											2022-04-07 16:32:03 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | signals: | 
					
						
							|  |  |  |     void closing(); | 
					
						
							|  |  |  |     void moveToWorkspace(int workspaceIndex); | 
					
						
							|  |  |  |     void forceShrink(); | 
					
						
							|  |  |  |     void deviceAdd(int deviceType, int deviceIndex); | 
					
						
							|  |  |  |     void deviceChange(int newDeviceIndex); | 
					
						
							| 
									
										
										
										
											2022-04-10 00:11:23 +02:00
										 |  |  |     void showSpectrum(int deviceSetIndex); | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     void showAllChannels(int deviceSetIndex); | 
					
						
							| 
									
										
										
										
											2022-04-15 18:59:29 +02:00
										 |  |  |     void addChannelEmitted(int channelPluginIndex); | 
					
						
							| 
									
										
										
										
											2022-04-13 18:43:37 +02:00
										 |  |  |     void deviceSetPresetsDialogRequested(QPoint, DeviceGUI*); | 
					
						
							| 
									
										
										
										
											2020-10-05 19:23:13 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_DEVICEGUI_H
 |