2020-10-04 00:16:15 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2022-04-12 10:20:45 -04:00
|
|
|
// Copyright (C) 2020-2022 Edouard Griffiths, F4EXB //
|
2020-10-04 00:16:15 -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 SDRGUI_CHANNEL_CHANNELGUI_H_
|
|
|
|
#define SDRGUI_CHANNEL_CHANNELGUI_H_
|
|
|
|
|
2022-04-12 10:20:45 -04:00
|
|
|
#include <QMdiSubWindow>
|
|
|
|
#include <QMap>
|
|
|
|
|
2022-04-22 13:21:24 -04:00
|
|
|
#include "gui/framelesswindowresizer.h"
|
2020-10-05 15:32:57 -04:00
|
|
|
#include "export.h"
|
2020-10-04 00:16:15 -04:00
|
|
|
|
|
|
|
class QCloseEvent;
|
|
|
|
class MessageQueue;
|
2022-04-12 10:20:45 -04:00
|
|
|
class QLabel;
|
|
|
|
class QPushButton;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QSizeGrip;
|
2022-04-14 06:08:18 -04:00
|
|
|
class RollupContents;
|
2022-04-16 10:45:53 -04:00
|
|
|
class ChannelMarker;
|
2020-10-04 00:16:15 -04:00
|
|
|
|
2022-04-12 10:20:45 -04:00
|
|
|
class SDRGUI_API ChannelGUI : public QMdiSubWindow
|
2020-10-04 00:16:15 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-04-12 10:20:45 -04:00
|
|
|
enum DeviceType
|
|
|
|
{
|
|
|
|
DeviceRx,
|
|
|
|
DeviceTx,
|
|
|
|
DeviceMIMO
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ContextMenuType
|
|
|
|
{
|
|
|
|
ContextMenuNone,
|
2022-04-17 19:42:03 -04:00
|
|
|
ContextMenuChannelSettings
|
2022-04-12 10:20:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
ChannelGUI(QWidget *parent = nullptr);
|
|
|
|
virtual ~ChannelGUI();
|
2020-10-04 00:16:15 -04:00
|
|
|
virtual void destroy() = 0;
|
|
|
|
|
|
|
|
virtual void resetToDefaults() = 0;
|
|
|
|
virtual QByteArray serialize() const = 0;
|
|
|
|
virtual bool deserialize(const QByteArray& data) = 0;
|
2022-04-12 10:20:45 -04:00
|
|
|
// Data saved in the derived settings
|
|
|
|
virtual void setWorkspaceIndex(int index)= 0;
|
|
|
|
virtual int getWorkspaceIndex() const = 0;
|
|
|
|
virtual void setGeometryBytes(const QByteArray& blob) = 0;
|
|
|
|
virtual QByteArray getGeometryBytes() const = 0;
|
|
|
|
virtual QString getTitle() const = 0;
|
|
|
|
virtual QColor getTitleColor() const = 0;
|
2022-04-12 12:27:27 -04:00
|
|
|
virtual void zetHidden(bool hidden) = 0;
|
|
|
|
virtual bool getHidden() const = 0;
|
2022-04-16 10:45:53 -04:00
|
|
|
virtual ChannelMarker& getChannelMarker() = 0;
|
2022-04-17 19:42:03 -04:00
|
|
|
virtual int getStreamIndex() const = 0;
|
|
|
|
virtual void setStreamIndex(int streamIndex) = 0;
|
2020-10-04 00:16:15 -04:00
|
|
|
|
|
|
|
virtual MessageQueue* getInputMessageQueue() = 0;
|
|
|
|
|
2022-04-14 06:08:18 -04:00
|
|
|
RollupContents *getRollupContents() { return m_rollupContents; }
|
2022-04-12 10:20:45 -04:00
|
|
|
void setTitle(const QString& title);
|
|
|
|
void setTitleColor(const QColor& c);
|
|
|
|
void setDeviceType(DeviceType type);
|
2022-04-17 04:20:07 -04:00
|
|
|
void setDisplayedame(const QString& name);
|
2022-04-12 10:20:45 -04:00
|
|
|
DeviceType getDeviceType() const { return m_deviceType; }
|
2022-04-18 06:08:33 -04:00
|
|
|
void setIndexToolTip(const QString& tooltip);
|
2022-04-12 10:20:45 -04:00
|
|
|
void setIndex(int index);
|
|
|
|
int getIndex() const { return m_channelIndex; }
|
|
|
|
void setDeviceSetIndex(int index);
|
2022-04-15 12:59:29 -04:00
|
|
|
int getDeviceSetIndex() const { return m_deviceSetIndex; }
|
2022-04-13 05:08:21 -04:00
|
|
|
void setStatusFrequency(qint64 frequency);
|
|
|
|
void setStatusText(const QString& text);
|
2022-04-12 10:20:45 -04:00
|
|
|
|
2020-10-04 00:16:15 -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-12 10:20:45 -04:00
|
|
|
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
|
2022-04-17 19:42:03 -04:00
|
|
|
void updateIndexLabel();
|
2022-04-23 07:59:22 -04:00
|
|
|
int getAdditionalHeight() const { return 29 + 26; }
|
2022-04-12 10:20:45 -04:00
|
|
|
|
|
|
|
DeviceType m_deviceType;
|
|
|
|
int m_deviceSetIndex;
|
|
|
|
int m_channelIndex;
|
|
|
|
QString m_helpURL;
|
2022-04-14 06:08:18 -04:00
|
|
|
RollupContents* m_rollupContents;
|
2022-04-12 10:20:45 -04:00
|
|
|
ContextMenuType m_contextMenuType;
|
2022-04-17 04:20:07 -04:00
|
|
|
QString m_displayedName;
|
2022-04-12 10:20:45 -04:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void shrinkWindow();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool isOnMovingPad();
|
|
|
|
QString getDeviceTypeTag();
|
|
|
|
static QColor getTitleColor(const QColor& backgroundColor);
|
|
|
|
|
|
|
|
QLabel *m_indexLabel;
|
|
|
|
QPushButton *m_settingsButton;
|
|
|
|
QLabel *m_titleLabel;
|
|
|
|
QPushButton *m_helpButton;
|
|
|
|
QPushButton *m_moveButton;
|
|
|
|
QPushButton *m_shrinkButton;
|
|
|
|
QPushButton *m_hideButton;
|
|
|
|
QPushButton *m_closeButton;
|
2022-04-15 12:59:29 -04:00
|
|
|
QPushButton *m_duplicateButton;
|
2022-04-16 10:45:53 -04:00
|
|
|
QPushButton *m_moveToDeviceButton;
|
2022-04-13 05:08:21 -04:00
|
|
|
QLabel *m_statusFrequency;
|
2022-04-12 10:20:45 -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;
|
|
|
|
QMap<QWidget*, int> m_heightsMap;
|
2022-04-22 13:21:24 -04:00
|
|
|
FramelessWindowResizer m_resizer;
|
2022-04-12 10:20:45 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void activateSettingsDialog();
|
|
|
|
void showHelp();
|
|
|
|
void openMoveToWorkspaceDialog();
|
|
|
|
void onWidgetRolled(QWidget *widget, bool show);
|
2022-04-15 12:59:29 -04:00
|
|
|
void duplicateChannel();
|
2022-04-16 10:45:53 -04:00
|
|
|
void openMoveToDeviceSetDialog();
|
2020-10-04 00:16:15 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void closing();
|
2022-04-12 10:20:45 -04:00
|
|
|
void moveToWorkspace(int workspaceIndex);
|
|
|
|
void forceShrink();
|
2022-04-15 12:59:29 -04:00
|
|
|
void duplicateChannelEmitted();
|
2022-04-16 10:45:53 -04:00
|
|
|
void moveToDeviceSet(int deviceSetIndex);
|
2020-10-04 00:16:15 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SDRGUI_CHANNEL_CHANNELGUI_H_
|