2020-10-05 13:23:13 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2022-04-07 10:32:03 -04:00
|
|
|
// Copyright (C) 2020-2022 Edouard Griffiths, F4EXB //
|
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-04-12 10:20:45 -04:00
|
|
|
#include "gui/channeladddialog.h"
|
2022-04-22 13:21:24 -04:00
|
|
|
#include "gui/framelesswindowresizer.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 QLabel;
|
|
|
|
class QPushButton;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QSizeGrip;
|
2022-05-13 16:24:48 -04:00
|
|
|
class DeviceUISet;
|
|
|
|
|
2022-04-07 10:32:03 -04:00
|
|
|
class SDRGUI_API DeviceGUI : public QMdiSubWindow {
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
DeviceGUI(QWidget *parent = nullptr);
|
|
|
|
virtual ~DeviceGUI();
|
2020-10-05 13:23:13 -04:00
|
|
|
virtual void destroy() = 0;
|
|
|
|
|
|
|
|
virtual void resetToDefaults() = 0;
|
|
|
|
virtual QByteArray serialize() const = 0;
|
|
|
|
virtual bool deserialize(const QByteArray& data) = 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; }
|
|
|
|
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); }
|
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-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;
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void shrinkWindow();
|
|
|
|
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
QHBoxLayout *m_centerLayout;
|
|
|
|
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-22 13:21:24 -04:00
|
|
|
FramelessWindowResizer m_resizer;
|
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
|