2020-10-03 17:55:24 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2020 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_FEATURE_FEATUREGUI_H_
|
|
|
|
#define SDRGUI_FEATURE_FEATUREGUI_H_
|
|
|
|
|
2022-04-04 04:23:52 -04:00
|
|
|
#include <QMdiSubWindow>
|
2022-04-12 10:20:45 -04:00
|
|
|
#include <QMap>
|
2022-04-04 04:23:52 -04:00
|
|
|
|
2022-04-22 13:21:24 -04:00
|
|
|
#include "gui/framelesswindowresizer.h"
|
2022-04-04 04:23:52 -04:00
|
|
|
#include "gui/rollupcontents.h"
|
2020-10-05 15:32:57 -04:00
|
|
|
#include "export.h"
|
2020-10-03 17:55:24 -04:00
|
|
|
|
|
|
|
class QCloseEvent;
|
|
|
|
class MessageQueue;
|
2022-04-04 04:23:52 -04:00
|
|
|
class QLabel;
|
|
|
|
class QPushButton;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QSizeGrip;
|
2022-05-13 16:24:48 -04:00
|
|
|
class Feature;
|
2020-10-03 17:55:24 -04:00
|
|
|
|
2022-04-04 04:23:52 -04:00
|
|
|
class SDRGUI_API FeatureGUI : public QMdiSubWindow
|
2020-10-03 17:55:24 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-04-04 04:23:52 -04:00
|
|
|
enum ContextMenuType
|
|
|
|
{
|
|
|
|
ContextMenuNone,
|
2022-04-18 06:08:33 -04:00
|
|
|
ContextMenuChannelSettings
|
2022-04-04 04:23:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
FeatureGUI(QWidget *parent = nullptr);
|
|
|
|
virtual ~FeatureGUI();
|
2020-10-03 17:55:24 -04:00
|
|
|
virtual void destroy() = 0;
|
|
|
|
|
|
|
|
virtual void resetToDefaults() = 0;
|
|
|
|
virtual QByteArray serialize() const = 0;
|
|
|
|
virtual bool deserialize(const QByteArray& data) = 0;
|
2022-04-05 10:26:57 -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;
|
2020-10-03 17:55:24 -04:00
|
|
|
|
|
|
|
virtual MessageQueue* getInputMessageQueue() = 0;
|
|
|
|
|
2022-04-04 04:23:52 -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-04 04:23:52 -04:00
|
|
|
void setTitleColor(const QColor&) {} // not implemented for a feature
|
|
|
|
void setTitle(const QString& title);
|
|
|
|
void setIndex(int index);
|
2022-04-05 10:26:57 -04:00
|
|
|
int getIndex() const { return m_featureIndex; }
|
2022-04-18 06:08:33 -04:00
|
|
|
void setDisplayedame(const QString& name);
|
2022-04-04 04:23:52 -04:00
|
|
|
|
2020-10-03 17:55:24 -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-04 04:23:52 -04:00
|
|
|
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
|
2022-04-26 13:18:48 -04:00
|
|
|
int getAdditionalHeight() const { return 22 + 22; } // height of top and bottom bars
|
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-04 04:23:52 -04:00
|
|
|
|
2022-05-13 16:24:48 -04:00
|
|
|
Feature *m_feature;
|
2022-04-04 04:23:52 -04:00
|
|
|
int m_featureIndex;
|
|
|
|
QString m_helpURL;
|
|
|
|
RollupContents m_rollupContents;
|
|
|
|
ContextMenuType m_contextMenuType;
|
2022-04-18 06:08:33 -04:00
|
|
|
QString m_displayedName;
|
2022-04-04 04:23:52 -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-04 04:23:52 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool isOnMovingPad();
|
|
|
|
|
|
|
|
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-04 04:23:52 -04:00
|
|
|
QPushButton *m_closeButton;
|
|
|
|
QLabel *m_statusLabel;
|
|
|
|
QVBoxLayout *m_layouts;
|
|
|
|
QHBoxLayout *m_topLayout;
|
|
|
|
QHBoxLayout *m_centerLayout;
|
|
|
|
QHBoxLayout *m_bottomLayout;
|
|
|
|
QSizeGrip *m_sizeGripBottomRight;
|
|
|
|
bool m_drag;
|
|
|
|
QPoint m_DragPosition;
|
2022-04-12 10:20:45 -04:00
|
|
|
QMap<QWidget*, int> m_heightsMap;
|
2022-04-22 13:21:24 -04:00
|
|
|
FramelessWindowResizer m_resizer;
|
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-04-04 04:23:52 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void activateSettingsDialog();
|
|
|
|
void showHelp();
|
|
|
|
void openMoveToWorkspaceDialog();
|
2022-04-12 10:20:45 -04:00
|
|
|
void onWidgetRolled(QWidget *widget, bool show);
|
2020-10-03 17:55:24 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void closing();
|
2022-04-04 04:23:52 -04:00
|
|
|
void moveToWorkspace(int workspaceIndex);
|
|
|
|
void forceShrink();
|
2020-10-03 17:55:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SDRGUI_FEATURE_FEATUREGUI_H_
|