2020-10-05 13:23:13 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2023-11-19 07:31:45 -05: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 13:23:13 -04: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 10:32:03 -04:00
|
|
|
#include <QMdiSubWindow>
|
|
|
|
|
2020-10-05 13:23:13 -04:00
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QString>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QWidget>
|
2022-12-20 11:10:11 -05:00
|
|
|
#include <QLabel>
|
2020-10-05 13:23:13 -04:00
|
|
|
|
2022-04-12 10:20:45 -04:00
|
|
|
#include "gui/channeladddialog.h"
|
2022-04-22 13:21:24 -04:00
|
|
|
#include "gui/framelesswindowresizer.h"
|
2023-08-24 10:51:50 -04:00
|
|
|
#include "settings/serializableinterface.h"
|
2020-10-05 13:23:13 -04:00
|
|
|
#include "export.h"
|
|
|
|
|
2022-04-07 10:32:03 -04:00
|
|
|
class QCloseEvent;
|
2020-10-05 13:23:13 -04:00
|
|
|
class Message;
|
|
|
|
class MessageQueue;
|
2022-04-07 10:32:03 -04:00
|
|
|
class QPushButton;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QSizeGrip;
|
2022-05-13 16:24:48 -04:00
|
|
|
class DeviceUISet;
|
|
|
|
|
2023-08-24 10:51:50 -04:00
|
|
|
class SDRGUI_API DeviceGUI : public QMdiSubWindow, public SerializableInterface {
|
2022-04-07 10:32:03 -04:00
|
|
|
Q_OBJECT
|
2020-10-05 13:23:13 -04:00
|
|
|
public:
|
2022-04-07 10:32:03 -04:00
|
|
|
enum DeviceType
|
|
|
|
{
|
|
|
|
DeviceRx,
|
|
|
|
DeviceTx,
|
|
|
|
DeviceMIMO
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ContextMenuType
|
|
|
|
{
|
|
|
|
ContextMenuNone,
|
2022-04-16 19:31:50 -04:00
|
|
|
ContextMenuDeviceSettings
|
2022-04-07 10:32:03 -04:00
|
|
|
};
|
|
|
|
|
2024-09-07 15:50:42 -04:00
|
|
|
explicit DeviceGUI(QWidget *parent = nullptr);
|
|
|
|
~DeviceGUI() override;
|
2020-10-05 13:23:13 -04:00
|
|
|
|
|
|
|
virtual void resetToDefaults() = 0;
|
2022-05-13 16:24:48 -04:00
|
|
|
void setWorkspaceIndex(int index);
|
2022-04-20 14:08:41 -04:00
|
|
|
int getWorkspaceIndex() const { return m_workspaceIndex; }
|
2020-10-05 13:23:13 -04:00
|
|
|
|
|
|
|
virtual MessageQueue* getInputMessageQueue() = 0;
|
2022-04-07 10:32:03 -04:00
|
|
|
|
|
|
|
QWidget *getContents() { return m_contents; }
|
2022-11-09 10:53:44 -05:00
|
|
|
void sizeToContents();
|
2022-04-07 10:32:03 -04: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 10:20:45 -04:00
|
|
|
void setChannelNames(const QStringList& channelNames) { m_channelAddDialog.addChannelNames(channelNames); }
|
2023-08-24 10:51:50 -04:00
|
|
|
DeviceUISet* getDeviceUISet() { return m_deviceUISet; }
|
2023-12-06 05:14:01 -05:00
|
|
|
virtual void setReplayTime(float time) { (void) time; } //!< Not supported by all devices
|
2022-04-07 10:32:03 -04:00
|
|
|
|
|
|
|
protected:
|
2022-04-22 13:21:24 -04: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 10:32:03 -04:00
|
|
|
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
|
2022-04-26 13:44:14 -04:00
|
|
|
int getAdditionalHeight() const { return 22 + 22; }
|
2022-12-20 11:10:11 -05:00
|
|
|
void setStatus(const QString &status) { m_statusLabel->setText(status); }
|
2022-04-07 10:32:03 -04:00
|
|
|
|
2022-05-13 16:24:48 -04:00
|
|
|
DeviceUISet* m_deviceUISet;
|
2022-04-07 10:32:03 -04:00
|
|
|
DeviceType m_deviceType;
|
|
|
|
int m_deviceSetIndex;
|
2022-04-20 14:08:41 -04:00
|
|
|
int m_workspaceIndex;
|
2022-04-07 10:32:03 -04:00
|
|
|
QString m_helpURL;
|
|
|
|
QWidget *m_contents;
|
|
|
|
ContextMenuType m_contextMenuType;
|
2023-11-13 15:51:03 -05:00
|
|
|
FramelessWindowResizer m_resizer;
|
2022-04-07 10:32:03 -04:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void shrinkWindow();
|
2022-11-09 10:53:44 -05:00
|
|
|
void maximizeWindow();
|
2022-04-07 10:32:03 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool isOnMovingPad();
|
|
|
|
QString getDeviceTypeColor();
|
|
|
|
QString getDeviceTypeTag();
|
|
|
|
|
|
|
|
QLabel *m_indexLabel;
|
2022-04-16 19:31:50 -04:00
|
|
|
QPushButton *m_settingsButton;
|
2022-04-07 10:32:03 -04:00
|
|
|
QPushButton *m_changeDeviceButton;
|
|
|
|
QPushButton *m_reloadDeviceButton;
|
|
|
|
QPushButton *m_addChannelsButton;
|
2022-04-09 07:38:22 -04:00
|
|
|
QPushButton *m_deviceSetPresetsButton;
|
2022-04-07 10:32:03 -04:00
|
|
|
QLabel *m_titleLabel;
|
|
|
|
QPushButton *m_helpButton;
|
|
|
|
QPushButton *m_moveButton;
|
|
|
|
QPushButton *m_shrinkButton;
|
2022-11-09 10:53:44 -05:00
|
|
|
QPushButton *m_maximizeButton;
|
2022-04-07 10:32:03 -04:00
|
|
|
QPushButton *m_closeButton;
|
2022-04-09 07:38:22 -04:00
|
|
|
QPushButton *m_showSpectrumButton;
|
|
|
|
QPushButton *m_showAllChannelsButton;
|
2022-04-07 10:32:03 -04:00
|
|
|
QLabel *m_statusLabel;
|
|
|
|
QVBoxLayout *m_layouts;
|
|
|
|
QHBoxLayout *m_topLayout;
|
2022-12-20 11:10:11 -05:00
|
|
|
QVBoxLayout *m_centerLayout;
|
2022-04-07 10:32:03 -04:00
|
|
|
QHBoxLayout *m_bottomLayout;
|
|
|
|
QSizeGrip *m_sizeGripBottomRight;
|
|
|
|
bool m_drag;
|
|
|
|
QPoint m_DragPosition;
|
|
|
|
int m_currentDeviceIndex; //!< Index in device plugins registrations
|
2022-04-12 10:20:45 -04:00
|
|
|
ChannelAddDialog m_channelAddDialog;
|
2022-04-07 10:32:03 -04:00
|
|
|
|
|
|
|
private slots:
|
2022-04-16 19:31:50 -04:00
|
|
|
void activateSettingsDialog();
|
2022-04-07 10:32:03 -04:00
|
|
|
void openChangeDeviceDialog();
|
2022-04-12 10:20:45 -04:00
|
|
|
void openAddChannelsDialog();
|
2022-04-07 10:32:03 -04:00
|
|
|
void deviceReload();
|
|
|
|
void showHelp();
|
|
|
|
void openMoveToWorkspaceDialog();
|
2022-04-09 18:11:23 -04:00
|
|
|
void showSpectrumHandler();
|
2022-04-12 10:20:45 -04:00
|
|
|
void showAllChannelsHandler();
|
2022-04-13 12:43:37 -04:00
|
|
|
void deviceSetPresetsDialog();
|
2022-04-07 10:32:03 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void closing();
|
|
|
|
void moveToWorkspace(int workspaceIndex);
|
|
|
|
void forceShrink();
|
|
|
|
void deviceAdd(int deviceType, int deviceIndex);
|
|
|
|
void deviceChange(int newDeviceIndex);
|
2022-04-09 18:11:23 -04:00
|
|
|
void showSpectrum(int deviceSetIndex);
|
2022-04-12 10:20:45 -04:00
|
|
|
void showAllChannels(int deviceSetIndex);
|
2022-04-15 12:59:29 -04:00
|
|
|
void addChannelEmitted(int channelPluginIndex);
|
2022-04-13 12:43:37 -04:00
|
|
|
void deviceSetPresetsDialogRequested(QPoint, DeviceGUI*);
|
2020-10-05 13:23:13 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_DEVICEGUI_H
|