2022-04-09 07:38:22 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2023-11-19 07:31:45 -05:00
|
|
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
|
|
// written by Christian Daniel //
|
|
|
|
// Copyright (C) 2015-2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
|
|
|
// Copyright (C) 2022 Jon Beniston, M7RCE <jon@beniston.com> //
|
2022-04-09 07:38:22 -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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <QCloseEvent>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QSizeGrip>
|
|
|
|
#include <QObjectCleanupHandler>
|
|
|
|
#include <QDesktopServices>
|
2022-12-20 11:22:21 -05:00
|
|
|
#include <QMdiArea>
|
2022-04-09 07:38:22 -04:00
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "gui/glspectrum.h"
|
|
|
|
#include "gui/glspectrumgui.h"
|
|
|
|
#include "gui/workspaceselectiondialog.h"
|
2022-05-13 16:24:48 -04:00
|
|
|
#include "dsp/spectrumvis.h"
|
2022-04-09 07:38:22 -04:00
|
|
|
#include "mainspectrumgui.h"
|
|
|
|
|
2022-09-29 08:48:04 -04:00
|
|
|
MainSpectrumGUI::MainSpectrumGUI(GLSpectrum *spectrum, GLSpectrumGUI *spectrumGUI, QWidget *parent) :
|
2022-04-09 07:38:22 -04:00
|
|
|
QMdiSubWindow(parent),
|
|
|
|
m_spectrum(spectrum),
|
|
|
|
m_spectrumGUI(spectrumGUI),
|
|
|
|
m_deviceType(DeviceRx),
|
|
|
|
m_deviceSetIndex(0),
|
2022-04-22 13:21:24 -04:00
|
|
|
m_drag(false),
|
2022-12-20 11:22:21 -05:00
|
|
|
m_resizer(this),
|
|
|
|
m_mdi(nullptr)
|
2022-04-09 07:38:22 -04:00
|
|
|
{
|
|
|
|
qDebug("MainSpectrumGUI::MainSpectrumGUI: %p", parent);
|
|
|
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
2022-04-19 01:03:28 -04:00
|
|
|
m_helpURL = "sdrgui/mainspectrum/readme.md";
|
2022-04-23 20:48:10 -04:00
|
|
|
setObjectName("MainSpectrumGUI");
|
|
|
|
setStyleSheet(QString(tr("#MainSpectrumGUI { border: 1px solid %1; background-color: %2; }")
|
|
|
|
.arg(palette().highlight().color().darker(115).name()))
|
|
|
|
.arg(palette().window().color().name()));
|
2022-04-09 07:38:22 -04:00
|
|
|
|
2022-04-20 16:33:28 -04:00
|
|
|
setMinimumSize(m_MinimumWidth, m_MinimumHeight);
|
|
|
|
|
2022-04-09 07:38:22 -04:00
|
|
|
m_indexLabel = new QLabel();
|
|
|
|
m_indexLabel->setFixedSize(32, 16);
|
|
|
|
m_indexLabel->setStyleSheet("QLabel { background-color: rgb(128, 128, 128); qproperty-alignment: AlignCenter; }");
|
|
|
|
m_indexLabel->setText(tr("X:%1").arg(m_deviceSetIndex));
|
|
|
|
m_indexLabel->setToolTip("Device type and set index");
|
|
|
|
|
|
|
|
m_spacerLabel = new QLabel();
|
|
|
|
m_spacerLabel->setFixedWidth(5);
|
|
|
|
|
|
|
|
m_titleLabel = new QLabel();
|
|
|
|
m_titleLabel->setText("Device");
|
|
|
|
m_titleLabel->setToolTip("Device identification");
|
|
|
|
m_titleLabel->setFixedHeight(20);
|
|
|
|
m_titleLabel->setMinimumWidth(20);
|
|
|
|
m_titleLabel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
|
|
|
|
|
|
|
m_helpButton = new QPushButton();
|
|
|
|
m_helpButton->setFixedSize(20, 20);
|
|
|
|
QIcon helpIcon(":/help.png");
|
|
|
|
m_helpButton->setIcon(helpIcon);
|
|
|
|
m_helpButton->setToolTip("Show spectrum window documentation in browser");
|
|
|
|
|
|
|
|
m_moveButton = new QPushButton();
|
|
|
|
m_moveButton->setFixedSize(20, 20);
|
|
|
|
QIcon moveIcon(":/exit.png");
|
|
|
|
m_moveButton->setIcon(moveIcon);
|
2022-04-18 06:08:33 -04:00
|
|
|
m_moveButton->setToolTip("Move to another workspace");
|
2022-04-09 07:38:22 -04:00
|
|
|
|
|
|
|
m_shrinkButton = new QPushButton();
|
|
|
|
m_shrinkButton->setFixedSize(20, 20);
|
|
|
|
QIcon shrinkIcon(":/shrink.png");
|
|
|
|
m_shrinkButton->setIcon(shrinkIcon);
|
|
|
|
m_shrinkButton->setToolTip("Adjust window to minimum size");
|
|
|
|
|
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
|
|
|
m_maximizeButton = new QPushButton();
|
|
|
|
m_maximizeButton->setFixedSize(20, 20);
|
|
|
|
QIcon maximizeIcon(":/maximize.png");
|
|
|
|
m_maximizeButton->setIcon(maximizeIcon);
|
2022-12-20 11:22:21 -05:00
|
|
|
m_maximizeButton->setToolTip("Adjust window to maximum size in workspace");
|
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
|
|
|
|
2022-04-09 07:38:22 -04:00
|
|
|
m_hideButton = new QPushButton();
|
|
|
|
m_hideButton->setFixedSize(20, 20);
|
|
|
|
QIcon hideIcon(":/hide.png");
|
|
|
|
m_hideButton->setIcon(hideIcon);
|
|
|
|
m_hideButton->setToolTip("Hide device");
|
|
|
|
|
|
|
|
m_statusLabel = new QLabel();
|
|
|
|
// m_statusLabel->setText("OK"); // for future use
|
|
|
|
m_statusLabel->setFixedHeight(10);
|
|
|
|
m_statusLabel->setMinimumWidth(10);
|
|
|
|
m_statusLabel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
|
|
|
// m_statusLabel->setToolTip("Spectrum status");
|
|
|
|
|
|
|
|
m_layouts = new QVBoxLayout();
|
2022-04-26 13:44:14 -04:00
|
|
|
m_layouts->setContentsMargins(m_resizer.m_gripSize, m_resizer.m_gripSize, m_resizer.m_gripSize, m_resizer.m_gripSize);
|
2022-04-09 07:38:22 -04:00
|
|
|
m_layouts->setSpacing(0);
|
|
|
|
|
|
|
|
m_topLayout = new QHBoxLayout();
|
|
|
|
m_topLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
m_topLayout->addWidget(m_indexLabel);
|
|
|
|
m_topLayout->addWidget(m_spacerLabel);
|
|
|
|
m_topLayout->addWidget(m_titleLabel);
|
|
|
|
// m_topLayout->addStretch(1);
|
|
|
|
m_topLayout->addWidget(m_helpButton);
|
|
|
|
m_topLayout->addWidget(m_moveButton);
|
|
|
|
m_topLayout->addWidget(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
|
|
|
m_topLayout->addWidget(m_maximizeButton);
|
2022-04-09 07:38:22 -04:00
|
|
|
m_topLayout->addWidget(m_hideButton);
|
|
|
|
|
|
|
|
m_spectrumLayout = new QHBoxLayout();
|
2022-09-29 08:48:04 -04:00
|
|
|
m_spectrumLayout->addWidget(spectrum);
|
2022-04-09 07:38:22 -04:00
|
|
|
spectrum->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
|
|
m_spectrumGUILayout = new QHBoxLayout();
|
|
|
|
m_spectrumGUILayout->addWidget(spectrumGUI);
|
|
|
|
|
|
|
|
m_bottomLayout = new QHBoxLayout();
|
|
|
|
m_bottomLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
m_bottomLayout->addWidget(m_statusLabel);
|
|
|
|
m_sizeGripBottomRight = new QSizeGrip(this);
|
|
|
|
m_sizeGripBottomRight->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
2022-04-23 20:48:10 -04:00
|
|
|
m_sizeGripBottomRight->setFixedHeight(10);
|
2022-04-09 07:38:22 -04:00
|
|
|
//m_bottomLayout->addStretch(1);
|
|
|
|
m_bottomLayout->addWidget(m_sizeGripBottomRight, 0, Qt::AlignBottom | Qt::AlignRight);
|
|
|
|
|
|
|
|
m_layouts->addLayout(m_topLayout);
|
|
|
|
m_layouts->addLayout(m_spectrumLayout);
|
|
|
|
m_layouts->addLayout(m_spectrumGUILayout);
|
|
|
|
m_layouts->addLayout(m_bottomLayout);
|
|
|
|
|
|
|
|
QObjectCleanupHandler().add(layout());
|
|
|
|
setLayout(m_layouts);
|
|
|
|
|
|
|
|
connect(m_helpButton, SIGNAL(clicked()), this, SLOT(showHelp()));
|
|
|
|
connect(m_moveButton, SIGNAL(clicked()), this, SLOT(openMoveToWorkspaceDialog()));
|
|
|
|
connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(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
|
|
|
connect(m_maximizeButton, SIGNAL(clicked()), this, SLOT(maximizeWindow()));
|
2022-04-09 07:38:22 -04:00
|
|
|
connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow()));
|
|
|
|
connect(m_hideButton, SIGNAL(clicked()), this, SLOT(hide()));
|
|
|
|
|
2022-09-29 08:48:04 -04:00
|
|
|
connect(spectrum->getSpectrumView(), &GLSpectrumView::requestCenterFrequency, this, &MainSpectrumGUI::onRequestCenterFrequency);
|
2022-06-24 18:37:22 -04:00
|
|
|
connect(spectrumGUI, &GLSpectrumGUI::requestCenterFrequency, this, &MainSpectrumGUI::onRequestCenterFrequency);
|
2022-06-24 09:47:33 -04:00
|
|
|
|
2023-12-06 05:09:30 -05:00
|
|
|
connect(spectrum->getSpectrumView(), &GLSpectrumView::timeSelected, this, &MainSpectrumGUI::onTimeSelected);
|
|
|
|
|
2022-04-25 10:01:59 -04:00
|
|
|
m_resizer.enableChildMouseTracking();
|
2022-04-09 07:38:22 -04:00
|
|
|
shrinkWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
MainSpectrumGUI::~MainSpectrumGUI()
|
|
|
|
{
|
|
|
|
qDebug("MainSpectrumGUI::~MainSpectrumGUI");
|
2022-09-29 08:48:04 -04:00
|
|
|
m_spectrumLayout->removeWidget(m_spectrum);
|
2022-04-09 07:38:22 -04:00
|
|
|
m_spectrumGUILayout->removeWidget(m_spectrumGUI);
|
|
|
|
delete m_sizeGripBottomRight;
|
|
|
|
delete m_bottomLayout;
|
|
|
|
delete m_spectrumGUILayout;
|
|
|
|
delete m_spectrumLayout;
|
|
|
|
delete m_topLayout;
|
|
|
|
delete m_layouts;
|
|
|
|
delete m_statusLabel;
|
|
|
|
delete m_hideButton;
|
|
|
|
delete 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
|
|
|
delete m_maximizeButton;
|
2022-04-09 07:38:22 -04:00
|
|
|
delete m_moveButton;
|
|
|
|
delete m_helpButton;
|
|
|
|
delete m_titleLabel;
|
|
|
|
delete m_spacerLabel;
|
|
|
|
delete m_indexLabel;
|
|
|
|
qDebug("MainSpectrumGUI::~MainSpectrumGUI: end");
|
|
|
|
}
|
|
|
|
|
2022-05-13 16:24:48 -04:00
|
|
|
void MainSpectrumGUI::setWorkspaceIndex(int index)
|
|
|
|
{
|
|
|
|
m_workspaceIndex = index;
|
|
|
|
m_spectrum->getSpectrumVis()->setWorkspaceIndex(index);
|
|
|
|
}
|
|
|
|
|
2022-04-09 07:38:22 -04:00
|
|
|
void MainSpectrumGUI::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
|
|
|
qDebug("MainSpectrumGUI::closeEvent");
|
|
|
|
emit closing();
|
|
|
|
event->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::mousePressEvent(QMouseEvent* event)
|
|
|
|
{
|
|
|
|
if ((event->button() == Qt::LeftButton) && isOnMovingPad())
|
|
|
|
{
|
|
|
|
m_drag = true;
|
|
|
|
m_DragPosition = event->globalPos() - pos();
|
|
|
|
event->accept();
|
|
|
|
}
|
2022-04-22 13:21:24 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_resizer.mousePressEvent(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::mouseReleaseEvent(QMouseEvent* event)
|
|
|
|
{
|
|
|
|
m_resizer.mouseReleaseEvent(event);
|
2022-04-09 07:38:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::mouseMoveEvent(QMouseEvent* event)
|
|
|
|
{
|
|
|
|
if ((event->buttons() & Qt::LeftButton) && isOnMovingPad())
|
|
|
|
{
|
|
|
|
move(event->globalPos() - m_DragPosition);
|
|
|
|
event->accept();
|
|
|
|
}
|
2022-04-22 13:21:24 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_resizer.mouseMoveEvent(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::leaveEvent(QEvent* event)
|
|
|
|
{
|
|
|
|
m_resizer.leaveEvent(event);
|
|
|
|
QMdiSubWindow::leaveEvent(event);
|
2022-04-09 07:38:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::showHelp()
|
|
|
|
{
|
|
|
|
if (m_helpURL.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString url;
|
|
|
|
|
|
|
|
if (m_helpURL.startsWith("http")) {
|
|
|
|
url = m_helpURL;
|
|
|
|
} else {
|
2022-05-15 05:11:56 -04:00
|
|
|
url = QString("https://github.com/f4exb/sdrangel/blob/master/%1").arg(m_helpURL); // Something like "plugins/channelrx/chanalyzer/readme.md"
|
2022-04-09 07:38:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
QDesktopServices::openUrl(QUrl(url));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::openMoveToWorkspaceDialog()
|
|
|
|
{
|
|
|
|
int numberOfWorkspaces = MainWindow::getInstance()->getNumberOfWorkspaces();
|
2024-05-26 06:03:33 -04:00
|
|
|
WorkspaceSelectionDialog dialog(numberOfWorkspaces, getWorkspaceIndex(), this);
|
2022-04-09 07:38:22 -04:00
|
|
|
dialog.exec();
|
|
|
|
|
|
|
|
if (dialog.hasChanged()) {
|
|
|
|
emit moveToWorkspace(dialog.getSelectedIndex());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 MainSpectrumGUI::maximizeWindow()
|
|
|
|
{
|
2022-12-20 11:22:21 -05:00
|
|
|
// If maximize is pressed when maximized, go full screen
|
|
|
|
if (isMaximized())
|
|
|
|
{
|
|
|
|
m_mdi = mdiArea();
|
|
|
|
if (m_mdi) {
|
|
|
|
m_mdi->removeSubWindow(this);
|
|
|
|
}
|
|
|
|
showNormal(); // If we don't go back to normal first, window doesn't get bigger
|
|
|
|
showFullScreen();
|
|
|
|
m_shrinkButton->setToolTip("Adjust window to maximum size in workspace");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
showMaximized();
|
|
|
|
m_shrinkButton->setToolTip("Restore window to normal");
|
|
|
|
m_maximizeButton->setToolTip("Make window full screen");
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2022-04-09 07:38:22 -04:00
|
|
|
void MainSpectrumGUI::shrinkWindow()
|
|
|
|
{
|
|
|
|
qDebug("MainSpectrumGUI::shrinkWindow");
|
2022-12-20 11:22:21 -05:00
|
|
|
if (m_mdi)
|
|
|
|
{
|
|
|
|
showNormal();
|
|
|
|
m_mdi->addSubWindow(this);
|
|
|
|
show();
|
|
|
|
showMaximized();
|
|
|
|
m_shrinkButton->setToolTip("Restore window to normal");
|
|
|
|
m_mdi = nullptr;
|
|
|
|
}
|
|
|
|
else if (isMaximized())
|
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
|
|
|
{
|
|
|
|
showNormal();
|
2022-12-20 11:22:21 -05:00
|
|
|
m_shrinkButton->setToolTip("Adjust window to minimum size");
|
|
|
|
m_maximizeButton->setToolTip("Adjust window to maximum size in workspace");
|
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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
adjustSize();
|
|
|
|
resize(width(), m_MinimumHeight);
|
|
|
|
}
|
2022-04-09 07:38:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::setTitle(const QString& title)
|
|
|
|
{
|
2022-12-20 11:22:21 -05:00
|
|
|
setWindowTitle(title + " Spectrum");
|
2022-04-09 07:38:22 -04:00
|
|
|
m_titleLabel->setText(title);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString MainSpectrumGUI::getTitle() const
|
|
|
|
{
|
|
|
|
return m_titleLabel->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MainSpectrumGUI::isOnMovingPad()
|
|
|
|
{
|
|
|
|
return m_indexLabel->underMouse() ||
|
|
|
|
m_spacerLabel->underMouse() ||
|
|
|
|
m_titleLabel->underMouse() ||
|
|
|
|
m_statusLabel->underMouse();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::setIndex(int index)
|
|
|
|
{
|
|
|
|
m_deviceSetIndex = index;
|
|
|
|
m_indexLabel->setText(tr("%1:%2").arg(getDeviceTypeTag()).arg(m_deviceSetIndex));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::setDeviceType(DeviceType type)
|
|
|
|
{
|
|
|
|
m_deviceType = type;
|
|
|
|
m_indexLabel->setStyleSheet(tr("QLabel { background-color: %1; qproperty-alignment: AlignCenter; }").arg(getDeviceTypeColor()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainSpectrumGUI::setToolTip(const QString& tooltip)
|
|
|
|
{
|
|
|
|
m_titleLabel->setToolTip(tooltip);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString MainSpectrumGUI::getDeviceTypeColor()
|
|
|
|
{
|
|
|
|
switch(m_deviceType)
|
|
|
|
{
|
|
|
|
case DeviceRx:
|
|
|
|
return "rgb(0, 128, 0)";
|
|
|
|
case DeviceTx:
|
|
|
|
return "rgb(204, 0, 0)";
|
|
|
|
case DeviceMIMO:
|
|
|
|
return "rgb(0, 0, 192)";
|
|
|
|
default:
|
|
|
|
return "rgb(128, 128, 128)";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString MainSpectrumGUI::getDeviceTypeTag()
|
|
|
|
{
|
|
|
|
switch(m_deviceType)
|
|
|
|
{
|
|
|
|
case DeviceRx:
|
|
|
|
return "R";
|
|
|
|
case DeviceTx:
|
|
|
|
return "T";
|
|
|
|
case DeviceMIMO:
|
|
|
|
return "M";
|
|
|
|
default:
|
|
|
|
return "X";
|
|
|
|
}
|
|
|
|
}
|
2022-06-24 09:47:33 -04:00
|
|
|
|
2022-06-24 18:37:22 -04:00
|
|
|
// Handle request from GLSpectrum/GLSpectrumGUI to adjust center frequency
|
2022-06-24 09:47:33 -04:00
|
|
|
void MainSpectrumGUI::onRequestCenterFrequency(qint64 frequency)
|
|
|
|
{
|
2022-06-24 16:52:17 -04:00
|
|
|
emit requestCenterFrequency(m_deviceSetIndex, frequency);
|
2022-06-24 09:47:33 -04:00
|
|
|
}
|
2023-12-06 05:09:30 -05:00
|
|
|
|
|
|
|
void MainSpectrumGUI::onTimeSelected(float time)
|
|
|
|
{
|
|
|
|
emit timeSelected(m_deviceSetIndex, time);
|
|
|
|
}
|