From 8a3d2bd497aa1b323db1f0510c13ee2e61adc734 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 14 Apr 2022 12:08:18 +0200 Subject: [PATCH] Massive UI revamping (v7): Removed forceClose --- sdrgui/channel/channelgui.cpp | 10 ++++++---- sdrgui/channel/channelgui.h | 6 +++--- sdrgui/device/devicegui.cpp | 4 +--- sdrgui/device/devicegui.h | 1 - sdrgui/mainspectrum/mainspectrumgui.cpp | 1 - sdrgui/mainspectrum/mainspectrumgui.h | 1 - sdrgui/mainwindow.cpp | 6 +++--- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sdrgui/channel/channelgui.cpp b/sdrgui/channel/channelgui.cpp index 383ec3828..d7ae3ab46 100644 --- a/sdrgui/channel/channelgui.cpp +++ b/sdrgui/channel/channelgui.cpp @@ -28,6 +28,7 @@ #include "mainwindow.h" #include "gui/workspaceselectiondialog.h" +#include "gui/rollupcontents.h" #include "channelgui.h" @@ -129,7 +130,8 @@ ChannelGUI::ChannelGUI(QWidget *parent) : m_topLayout->addWidget(m_sizeGripTopRight, 0, Qt::AlignTop | Qt::AlignRight); m_centerLayout = new QHBoxLayout(); - m_centerLayout->addWidget(&m_rollupContents); + m_rollupContents = new RollupContents(); // Do not delete! Done in child's destructor with "delete ui" + m_centerLayout->addWidget(m_rollupContents); m_bottomLayout = new QHBoxLayout(); m_bottomLayout->setContentsMargins(0, 0, 0, 0); @@ -157,7 +159,7 @@ ChannelGUI::ChannelGUI(QWidget *parent) : connect(m_closeButton, SIGNAL(clicked()), this, SLOT(close())); connect( - &m_rollupContents, + m_rollupContents, &RollupContents::widgetRolled, this, &ChannelGUI::onWidgetRolled @@ -258,13 +260,13 @@ void ChannelGUI::onWidgetRolled(QWidget *widget, bool show) { // qDebug("ChannelGUI::onWidgetRolled: show: %d %d", m_rollupContents.height(), widget->height()); int dh = m_heightsMap.contains(widget) ? m_heightsMap[widget] - widget->height() : widget->minimumHeight(); - resize(width(), 52 + m_rollupContents.height() + dh); + resize(width(), 52 + 3 + m_rollupContents->height() + dh); } else { // qDebug("ChannelGUI::onWidgetRolled: hide: %d %d", m_rollupContents.height(), widget->height()); m_heightsMap[widget] = widget->height(); - resize(width(), 52 + m_rollupContents.height()); + resize(width(), 52 + 3 + m_rollupContents->height()); } } diff --git a/sdrgui/channel/channelgui.h b/sdrgui/channel/channelgui.h index 326384e64..cc0116fa4 100644 --- a/sdrgui/channel/channelgui.h +++ b/sdrgui/channel/channelgui.h @@ -21,7 +21,6 @@ #include #include -#include "gui/rollupcontents.h" #include "export.h" class QCloseEvent; @@ -31,6 +30,7 @@ class QPushButton; class QVBoxLayout; class QHBoxLayout; class QSizeGrip; +class RollupContents; class SDRGUI_API ChannelGUI : public QMdiSubWindow { @@ -69,7 +69,7 @@ public: virtual MessageQueue* getInputMessageQueue() = 0; - RollupContents *getRollupContents() { return &m_rollupContents; } + RollupContents *getRollupContents() { return m_rollupContents; } void setTitle(const QString& title); void setTitleColor(const QColor& c); void setDeviceType(DeviceType type); @@ -93,7 +93,7 @@ protected: int m_deviceSetIndex; int m_channelIndex; QString m_helpURL; - RollupContents m_rollupContents; + RollupContents* m_rollupContents; ContextMenuType m_contextMenuType; protected slots: diff --git a/sdrgui/device/devicegui.cpp b/sdrgui/device/devicegui.cpp index c4c68a84e..34eba9840 100644 --- a/sdrgui/device/devicegui.cpp +++ b/sdrgui/device/devicegui.cpp @@ -145,7 +145,7 @@ DeviceGUI::DeviceGUI(QWidget *parent) : m_topLayout->addWidget(m_sizeGripTopRight, 0, Qt::AlignTop | Qt::AlignRight); m_centerLayout = new QHBoxLayout(); - m_contents = new QWidget(); + m_contents = new QWidget(); // Do not delete! Done in child's destructor with "delete ui" m_centerLayout->addWidget(m_contents); m_bottomLayout = new QHBoxLayout(); @@ -175,7 +175,6 @@ DeviceGUI::DeviceGUI(QWidget *parent) : connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(shrinkWindow())); connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow())); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(close())); - connect(this, SIGNAL(forceClose()), this, SLOT(close())); connect(m_showSpectrumButton, SIGNAL(clicked()), this, SLOT(showSpectrumHandler())); connect(m_showAllChannelsButton, SIGNAL(clicked()), this, SLOT(showAllChannelsHandler())); @@ -209,7 +208,6 @@ DeviceGUI::~DeviceGUI() delete m_reloadDeviceButton; delete m_changeDeviceButton; delete m_indexLabel; - delete m_contents; qDebug("DeviceGUI::~DeviceGUI: end"); } diff --git a/sdrgui/device/devicegui.h b/sdrgui/device/devicegui.h index f8e99e894..595a0a112 100644 --- a/sdrgui/device/devicegui.h +++ b/sdrgui/device/devicegui.h @@ -134,7 +134,6 @@ private slots: void deviceSetPresetsDialog(); signals: - void forceClose(); void closing(); void moveToWorkspace(int workspaceIndex); void forceShrink(); diff --git a/sdrgui/mainspectrum/mainspectrumgui.cpp b/sdrgui/mainspectrum/mainspectrumgui.cpp index 04349036b..ef98a195a 100644 --- a/sdrgui/mainspectrum/mainspectrumgui.cpp +++ b/sdrgui/mainspectrum/mainspectrumgui.cpp @@ -135,7 +135,6 @@ MainSpectrumGUI::MainSpectrumGUI(GLSpectrum *spectrum, GLSpectrumGUI *spectrumGU connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(shrinkWindow())); connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow())); connect(m_hideButton, SIGNAL(clicked()), this, SLOT(hide())); - connect(this, SIGNAL(forceClose()), this, SLOT(close())); shrinkWindow(); } diff --git a/sdrgui/mainspectrum/mainspectrumgui.h b/sdrgui/mainspectrum/mainspectrumgui.h index 4a03ba983..29892af29 100644 --- a/sdrgui/mainspectrum/mainspectrumgui.h +++ b/sdrgui/mainspectrum/mainspectrumgui.h @@ -100,7 +100,6 @@ private slots: void shrinkWindow(); signals: - void forceClose(); void closing(); void moveToWorkspace(int workspaceIndex); void forceShrink(); diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index a0bd76e24..47be1a7d8 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -509,7 +509,7 @@ void MainWindow::sampleSourceCreate( // delete previous GUI if it exists if (deviceUISet->m_deviceGUI) { - emit deviceUISet->m_deviceGUI->forceClose(); + emit deviceUISet->m_deviceGUI->destroy(); } // constructs new GUI and input object @@ -727,7 +727,7 @@ void MainWindow::sampleSinkCreate( // delete previous plugin GUI if it exists if (deviceUISet->m_deviceGUI) { - emit deviceUISet->m_deviceGUI->forceClose(); + emit deviceUISet->m_deviceGUI->destroy(); } // constructs new GUI and output object @@ -919,7 +919,7 @@ void MainWindow::sampleMIMOCreate( // delete previous plugin GUI if it exists if (deviceUISet->m_deviceGUI) { - emit deviceUISet->m_deviceGUI->forceClose(); + emit deviceUISet->m_deviceGUI->destroy(); } // constructs new GUI and output object