2022-04-09 07:38:22 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// 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_MAINSPECTRUM_MAINSPECTRUMGUIGUI_H_
|
|
|
|
#define SDRGUI_MAINSPECTRUM_MAINSPECTRUMGUIGUI_H_
|
|
|
|
|
|
|
|
#include <QMdiSubWindow>
|
|
|
|
#include <QByteArray>
|
|
|
|
|
|
|
|
#include "util/messagequeue.h"
|
2022-04-22 13:21:24 -04:00
|
|
|
#include "gui/framelesswindowresizer.h"
|
2022-04-09 07:38:22 -04:00
|
|
|
#include "export.h"
|
|
|
|
|
|
|
|
class GLSpectrum;
|
|
|
|
class GLSpectrumGUI;
|
|
|
|
class QLabel;
|
|
|
|
class QPushButton;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QSizeGrip;
|
|
|
|
|
|
|
|
class SDRGUI_API MainSpectrumGUI : public QMdiSubWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum DeviceType
|
|
|
|
{
|
|
|
|
DeviceRx,
|
|
|
|
DeviceTx,
|
|
|
|
DeviceMIMO
|
|
|
|
};
|
|
|
|
|
|
|
|
MainSpectrumGUI(GLSpectrum *spectrum, GLSpectrumGUI *spectrumGUI, QWidget *parent = nullptr);
|
|
|
|
virtual ~MainSpectrumGUI();
|
|
|
|
|
|
|
|
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; }
|
2022-05-13 16:24:48 -04:00
|
|
|
void setWorkspaceIndex(int index);
|
2022-04-09 07:38:22 -04:00
|
|
|
int getWorkspaceIndex() const { return m_workspaceIndex; }
|
|
|
|
void setGeometryBytes(const QByteArray& blob) { m_geometryBytes = blob; }
|
|
|
|
const QByteArray& getGeometryBytes() const { return m_geometryBytes; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
GLSpectrum *m_spectrum;
|
|
|
|
GLSpectrumGUI *m_spectrumGUI;
|
|
|
|
int m_workspaceIndex;
|
|
|
|
QByteArray m_geometryBytes;
|
|
|
|
DeviceType m_deviceType;
|
|
|
|
int m_deviceSetIndex;
|
|
|
|
QString m_deviceTitle;
|
|
|
|
QString m_deviceTooltip;
|
|
|
|
QString m_helpURL;
|
|
|
|
|
|
|
|
QLabel *m_indexLabel;
|
|
|
|
QLabel *m_spacerLabel;
|
|
|
|
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-09 07:38:22 -04:00
|
|
|
QPushButton *m_hideButton;
|
|
|
|
QLabel *m_statusLabel;
|
|
|
|
QVBoxLayout *m_layouts;
|
|
|
|
QHBoxLayout *m_topLayout;
|
|
|
|
QHBoxLayout *m_spectrumLayout;
|
|
|
|
QHBoxLayout *m_spectrumGUILayout;
|
|
|
|
QHBoxLayout *m_bottomLayout;
|
|
|
|
QSizeGrip *m_sizeGripBottomRight;
|
|
|
|
bool m_drag;
|
|
|
|
QPoint m_DragPosition;
|
2022-04-22 13:21:24 -04:00
|
|
|
FramelessWindowResizer m_resizer;
|
2022-12-20 11:22:21 -05:00
|
|
|
QMdiArea *m_mdi; // Saved pointer to MDI when in full screen mode
|
2022-06-23 21:44:53 -04:00
|
|
|
static const int m_MinimumWidth = 380;
|
|
|
|
static const int m_MinimumHeight = 200 + 20 + 10 + 6*22 + 5;
|
2022-04-09 07:38:22 -04:00
|
|
|
|
2022-04-22 13:21:24 -04:00
|
|
|
protected:
|
|
|
|
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;
|
|
|
|
|
|
|
|
private:
|
2022-04-09 07:38:22 -04:00
|
|
|
bool isOnMovingPad();
|
|
|
|
QString getDeviceTypeColor();
|
|
|
|
QString getDeviceTypeTag();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void showHelp();
|
|
|
|
void openMoveToWorkspaceDialog();
|
|
|
|
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-06-24 09:47:33 -04:00
|
|
|
void onRequestCenterFrequency(qint64 frequency);
|
2022-04-09 07:38:22 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void closing();
|
|
|
|
void moveToWorkspace(int workspaceIndex);
|
|
|
|
void forceShrink();
|
2022-06-24 16:52:17 -04:00
|
|
|
void requestCenterFrequency(int deviceSetIndex, qint64 frequency); // an action from the user to move device center frequency
|
2022-04-09 07:38:22 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SDRGUI_MAINSPECTRUM_MAINSPECTRUMGUIGUI_H_
|