1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-05 06:37:51 -04:00

Massive UI revamping (v7): Removed forceClose

This commit is contained in:
f4exb 2022-04-14 12:08:18 +02:00
parent ec7a10e662
commit 8a3d2bd497
7 changed files with 13 additions and 16 deletions

View File

@ -28,6 +28,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "gui/workspaceselectiondialog.h" #include "gui/workspaceselectiondialog.h"
#include "gui/rollupcontents.h"
#include "channelgui.h" #include "channelgui.h"
@ -129,7 +130,8 @@ ChannelGUI::ChannelGUI(QWidget *parent) :
m_topLayout->addWidget(m_sizeGripTopRight, 0, Qt::AlignTop | Qt::AlignRight); m_topLayout->addWidget(m_sizeGripTopRight, 0, Qt::AlignTop | Qt::AlignRight);
m_centerLayout = new QHBoxLayout(); 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 = new QHBoxLayout();
m_bottomLayout->setContentsMargins(0, 0, 0, 0); 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_closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect( connect(
&m_rollupContents, m_rollupContents,
&RollupContents::widgetRolled, &RollupContents::widgetRolled,
this, this,
&ChannelGUI::onWidgetRolled &ChannelGUI::onWidgetRolled
@ -258,13 +260,13 @@ void ChannelGUI::onWidgetRolled(QWidget *widget, bool show)
{ {
// qDebug("ChannelGUI::onWidgetRolled: show: %d %d", m_rollupContents.height(), widget->height()); // qDebug("ChannelGUI::onWidgetRolled: show: %d %d", m_rollupContents.height(), widget->height());
int dh = m_heightsMap.contains(widget) ? m_heightsMap[widget] - widget->height() : widget->minimumHeight(); 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 else
{ {
// qDebug("ChannelGUI::onWidgetRolled: hide: %d %d", m_rollupContents.height(), widget->height()); // qDebug("ChannelGUI::onWidgetRolled: hide: %d %d", m_rollupContents.height(), widget->height());
m_heightsMap[widget] = widget->height(); m_heightsMap[widget] = widget->height();
resize(width(), 52 + m_rollupContents.height()); resize(width(), 52 + 3 + m_rollupContents->height());
} }
} }

View File

@ -21,7 +21,6 @@
#include <QMdiSubWindow> #include <QMdiSubWindow>
#include <QMap> #include <QMap>
#include "gui/rollupcontents.h"
#include "export.h" #include "export.h"
class QCloseEvent; class QCloseEvent;
@ -31,6 +30,7 @@ class QPushButton;
class QVBoxLayout; class QVBoxLayout;
class QHBoxLayout; class QHBoxLayout;
class QSizeGrip; class QSizeGrip;
class RollupContents;
class SDRGUI_API ChannelGUI : public QMdiSubWindow class SDRGUI_API ChannelGUI : public QMdiSubWindow
{ {
@ -69,7 +69,7 @@ public:
virtual MessageQueue* getInputMessageQueue() = 0; virtual MessageQueue* getInputMessageQueue() = 0;
RollupContents *getRollupContents() { return &m_rollupContents; } RollupContents *getRollupContents() { return m_rollupContents; }
void setTitle(const QString& title); void setTitle(const QString& title);
void setTitleColor(const QColor& c); void setTitleColor(const QColor& c);
void setDeviceType(DeviceType type); void setDeviceType(DeviceType type);
@ -93,7 +93,7 @@ protected:
int m_deviceSetIndex; int m_deviceSetIndex;
int m_channelIndex; int m_channelIndex;
QString m_helpURL; QString m_helpURL;
RollupContents m_rollupContents; RollupContents* m_rollupContents;
ContextMenuType m_contextMenuType; ContextMenuType m_contextMenuType;
protected slots: protected slots:

View File

@ -145,7 +145,7 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
m_topLayout->addWidget(m_sizeGripTopRight, 0, Qt::AlignTop | Qt::AlignRight); m_topLayout->addWidget(m_sizeGripTopRight, 0, Qt::AlignTop | Qt::AlignRight);
m_centerLayout = new QHBoxLayout(); 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_centerLayout->addWidget(m_contents);
m_bottomLayout = new QHBoxLayout(); m_bottomLayout = new QHBoxLayout();
@ -175,7 +175,6 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(shrinkWindow())); connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(shrinkWindow()));
connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow())); connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow()));
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(close())); 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_showSpectrumButton, SIGNAL(clicked()), this, SLOT(showSpectrumHandler()));
connect(m_showAllChannelsButton, SIGNAL(clicked()), this, SLOT(showAllChannelsHandler())); connect(m_showAllChannelsButton, SIGNAL(clicked()), this, SLOT(showAllChannelsHandler()));
@ -209,7 +208,6 @@ DeviceGUI::~DeviceGUI()
delete m_reloadDeviceButton; delete m_reloadDeviceButton;
delete m_changeDeviceButton; delete m_changeDeviceButton;
delete m_indexLabel; delete m_indexLabel;
delete m_contents;
qDebug("DeviceGUI::~DeviceGUI: end"); qDebug("DeviceGUI::~DeviceGUI: end");
} }

View File

@ -134,7 +134,6 @@ private slots:
void deviceSetPresetsDialog(); void deviceSetPresetsDialog();
signals: signals:
void forceClose();
void closing(); void closing();
void moveToWorkspace(int workspaceIndex); void moveToWorkspace(int workspaceIndex);
void forceShrink(); void forceShrink();

View File

@ -135,7 +135,6 @@ MainSpectrumGUI::MainSpectrumGUI(GLSpectrum *spectrum, GLSpectrumGUI *spectrumGU
connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(shrinkWindow())); connect(m_shrinkButton, SIGNAL(clicked()), this, SLOT(shrinkWindow()));
connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow())); connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow()));
connect(m_hideButton, SIGNAL(clicked()), this, SLOT(hide())); connect(m_hideButton, SIGNAL(clicked()), this, SLOT(hide()));
connect(this, SIGNAL(forceClose()), this, SLOT(close()));
shrinkWindow(); shrinkWindow();
} }

View File

@ -100,7 +100,6 @@ private slots:
void shrinkWindow(); void shrinkWindow();
signals: signals:
void forceClose();
void closing(); void closing();
void moveToWorkspace(int workspaceIndex); void moveToWorkspace(int workspaceIndex);
void forceShrink(); void forceShrink();

View File

@ -509,7 +509,7 @@ void MainWindow::sampleSourceCreate(
// delete previous GUI if it exists // delete previous GUI if it exists
if (deviceUISet->m_deviceGUI) { if (deviceUISet->m_deviceGUI) {
emit deviceUISet->m_deviceGUI->forceClose(); emit deviceUISet->m_deviceGUI->destroy();
} }
// constructs new GUI and input object // constructs new GUI and input object
@ -727,7 +727,7 @@ void MainWindow::sampleSinkCreate(
// delete previous plugin GUI if it exists // delete previous plugin GUI if it exists
if (deviceUISet->m_deviceGUI) { if (deviceUISet->m_deviceGUI) {
emit deviceUISet->m_deviceGUI->forceClose(); emit deviceUISet->m_deviceGUI->destroy();
} }
// constructs new GUI and output object // constructs new GUI and output object
@ -919,7 +919,7 @@ void MainWindow::sampleMIMOCreate(
// delete previous plugin GUI if it exists // delete previous plugin GUI if it exists
if (deviceUISet->m_deviceGUI) { if (deviceUISet->m_deviceGUI) {
emit deviceUISet->m_deviceGUI->forceClose(); emit deviceUISet->m_deviceGUI->destroy();
} }
// constructs new GUI and output object // constructs new GUI and output object