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-11-17 09:41:55 -05:00
|
|
|
#include "gui/qtcompatibility.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 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
|
|
|
|
2023-08-24 10:51:50 -04:00
|
|
|
class SDRGUI_API ChannelGUI : public QMdiSubWindow, public SerializableInterface
|
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;
|
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; }
|
dd maximize button to MainSpectrum and expandible Channels and Features.
Add sizeToContents in ChannelGUI and FeatureGUI, called when widget is
rolled, so we can remove resizing code from all of the individual
channels and features.
In RollupContents, use minimumSizeHint for calculated size, so that
minimumWidth can come from .ui file.
In DeviceGUI::sizeToContents(), call adjustSize(), so Device GUIs start
out at minimum needed size (which should restore appearance prior to
last patch).
In stackSubWindows, use available space for channels if no
spectrum/features present.
In stackSubWindows, fix spectrum from being sized too big, resulting in
scroll bars appearing.
Reset user-defined channel width in stackSubWindows, when channels are
removed.
Don't stack maximized windows.
There's one hack in Channel/FeatureGUI::maximizeWindow(). It seems that
when maximimzing a window, QOpenGLWidgets aren't always paint properly
immediately afterwards, so the code forces an additional update. I can't
see why the first call to paintGL doesn't work.
2022-11-11 07:24:27 -05:00
|
|
|
void sizeToContents();
|
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-26 13:18:48 -04:00
|
|
|
int getAdditionalHeight() const { return 22 + 22; } // height of top and bottom bars
|
2022-04-25 18:42:26 -04:00
|
|
|
void setHighlighted(bool highlighted);
|
2022-11-08 04:43:58 -05:00
|
|
|
int gripSize() { return m_resizer.m_gripSize; } // size in pixels of resize grip around the window
|
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;
|
2023-11-13 15:51:03 -05:00
|
|
|
FramelessWindowResizer m_resizer;
|
2022-04-12 10:20:45 -04:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void shrinkWindow();
|
dd maximize button to MainSpectrum and expandible Channels and Features.
Add sizeToContents in ChannelGUI and FeatureGUI, called when widget is
rolled, so we can remove resizing code from all of the individual
channels and features.
In RollupContents, use minimumSizeHint for calculated size, so that
minimumWidth can come from .ui file.
In DeviceGUI::sizeToContents(), call adjustSize(), so Device GUIs start
out at minimum needed size (which should restore appearance prior to
last patch).
In stackSubWindows, use available space for channels if no
spectrum/features present.
In stackSubWindows, fix spectrum from being sized too big, resulting in
scroll bars appearing.
Reset user-defined channel width in stackSubWindows, when channels are
removed.
Don't stack maximized windows.
There's one hack in Channel/FeatureGUI::maximizeWindow(). It seems that
when maximimzing a window, QOpenGLWidgets aren't always paint properly
immediately afterwards, so the code forces an additional update. I can't
see why the first call to paintGL doesn't work.
2022-11-11 07:24:27 -05:00
|
|
|
void maximizeWindow();
|
2022-04-12 10:20:45 -04:00
|
|
|
|
|
|
|
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;
|
dd maximize button to MainSpectrum and expandible Channels and Features.
Add sizeToContents in ChannelGUI and FeatureGUI, called when widget is
rolled, so we can remove resizing code from all of the individual
channels and features.
In RollupContents, use minimumSizeHint for calculated size, so that
minimumWidth can come from .ui file.
In DeviceGUI::sizeToContents(), call adjustSize(), so Device GUIs start
out at minimum needed size (which should restore appearance prior to
last patch).
In stackSubWindows, use available space for channels if no
spectrum/features present.
In stackSubWindows, fix spectrum from being sized too big, resulting in
scroll bars appearing.
Reset user-defined channel width in stackSubWindows, when channels are
removed.
Don't stack maximized windows.
There's one hack in Channel/FeatureGUI::maximizeWindow(). It seems that
when maximimzing a window, QOpenGLWidgets aren't always paint properly
immediately afterwards, so the code forces an additional update. I can't
see why the first call to paintGL doesn't work.
2022-11-11 07:24:27 -05:00
|
|
|
QPushButton *m_maximizeButton;
|
2022-04-12 10:20:45 -04:00
|
|
|
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;
|
dd maximize button to MainSpectrum and expandible Channels and Features.
Add sizeToContents in ChannelGUI and FeatureGUI, called when widget is
rolled, so we can remove resizing code from all of the individual
channels and features.
In RollupContents, use minimumSizeHint for calculated size, so that
minimumWidth can come from .ui file.
In DeviceGUI::sizeToContents(), call adjustSize(), so Device GUIs start
out at minimum needed size (which should restore appearance prior to
last patch).
In stackSubWindows, use available space for channels if no
spectrum/features present.
In stackSubWindows, fix spectrum from being sized too big, resulting in
scroll bars appearing.
Reset user-defined channel width in stackSubWindows, when channels are
removed.
Don't stack maximized windows.
There's one hack in Channel/FeatureGUI::maximizeWindow(). It seems that
when maximimzing a window, QOpenGLWidgets aren't always paint properly
immediately afterwards, so the code forces an additional update. I can't
see why the first call to paintGL doesn't work.
2022-11-11 07:24:27 -05:00
|
|
|
bool m_disableResize;
|
2022-12-20 11:10:11 -05:00
|
|
|
QMdiArea *m_mdi; // Saved pointer to MDI when in full screen mode
|
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_
|