1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Main Window: added option to hide or show the main spectrum in the central widget. Fixes #1152

This commit is contained in:
f4exb 2022-02-16 00:49:22 +01:00
parent dc9c60d48e
commit 8e79cd7ff2
10 changed files with 39 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

View File

@ -36,6 +36,7 @@ Preset::Preset(const Preset& other) :
m_iqImbalanceCorrection(other.m_iqImbalanceCorrection), m_iqImbalanceCorrection(other.m_iqImbalanceCorrection),
m_channelConfigs(other.m_channelConfigs), m_channelConfigs(other.m_channelConfigs),
m_deviceConfigs(other.m_deviceConfigs), m_deviceConfigs(other.m_deviceConfigs),
m_showSpectrum(other.m_showSpectrum),
m_layout(other.m_layout) m_layout(other.m_layout)
{} {}
@ -50,6 +51,7 @@ void Preset::resetToDefaults()
m_channelConfigs.clear(); m_channelConfigs.clear();
m_dcOffsetCorrection = false; m_dcOffsetCorrection = false;
m_iqImbalanceCorrection = false; m_iqImbalanceCorrection = false;
m_showSpectrum = true;
} }
QByteArray Preset::serialize() const QByteArray Preset::serialize() const
@ -69,6 +71,7 @@ QByteArray Preset::serialize() const
s.writeBlob(5, m_spectrumConfig); s.writeBlob(5, m_spectrumConfig);
s.writeBool(6, m_presetType == PresetSource); s.writeBool(6, m_presetType == PresetSource);
s.writeS32(7, (int) m_presetType); s.writeS32(7, (int) m_presetType);
s.writeBool(8, m_showSpectrum);
s.writeS32(20, m_deviceConfigs.size()); s.writeS32(20, m_deviceConfigs.size());
@ -126,6 +129,7 @@ bool Preset::deserialize(const QByteArray& data)
d.readBlob(5, &m_spectrumConfig); d.readBlob(5, &m_spectrumConfig);
d.readBool(6, &tmpBool, true); d.readBool(6, &tmpBool, true);
d.readS32(7, &tmp, PresetSource); d.readS32(7, &tmp, PresetSource);
d.readBool(8, &m_showSpectrum, true);
m_presetType = tmp < (int) PresetSource ? PresetSource : tmp > (int) PresetMIMO ? PresetMIMO : (PresetType) tmp; m_presetType = tmp < (int) PresetSource ? PresetSource : tmp > (int) PresetMIMO ? PresetMIMO : (PresetType) tmp;
if (m_presetType != PresetMIMO) { if (m_presetType != PresetMIMO) {

View File

@ -96,6 +96,8 @@ public:
bool hasIQImbalanceCorrection() const { return m_iqImbalanceCorrection; } bool hasIQImbalanceCorrection() const { return m_iqImbalanceCorrection; }
void setIQImbalanceCorrection(bool iqImbalanceCorrection) { m_iqImbalanceCorrection = iqImbalanceCorrection; } void setIQImbalanceCorrection(bool iqImbalanceCorrection) { m_iqImbalanceCorrection = iqImbalanceCorrection; }
void setShowSpectrum(bool show) { m_showSpectrum = show; }
bool getShowSpectrum() const { return m_showSpectrum; }
void setLayout(const QByteArray& data) { m_layout = data; } void setLayout(const QByteArray& data) { m_layout = data; }
const QByteArray& getLayout() const { return m_layout; } const QByteArray& getLayout() const { return m_layout; }
@ -164,6 +166,7 @@ protected:
DeviceeConfigs m_deviceConfigs; DeviceeConfigs m_deviceConfigs;
// screen and dock layout // screen and dock layout
bool m_showSpectrum;
QByteArray m_layout; QByteArray m_layout;
private: private:

View File

@ -139,13 +139,13 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
// work around broken Qt dock widget ordering // work around broken Qt dock widget ordering
removeDockWidget(ui->inputViewDock); removeDockWidget(ui->inputViewDock);
removeDockWidget(ui->spectraDisplayDock); removeDockWidget(ui->spectraControlDock);
removeDockWidget(ui->presetDock); removeDockWidget(ui->presetDock);
removeDockWidget(ui->commandsDock); removeDockWidget(ui->commandsDock);
removeDockWidget(ui->channelDock); removeDockWidget(ui->channelDock);
removeDockWidget(ui->featureDock); removeDockWidget(ui->featureDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->inputViewDock); addDockWidget(Qt::LeftDockWidgetArea, ui->inputViewDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->spectraDisplayDock); addDockWidget(Qt::LeftDockWidgetArea, ui->spectraControlDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock); addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->commandsDock); addDockWidget(Qt::LeftDockWidgetArea, ui->commandsDock);
tabifyDockWidget(ui->presetDock, ui->commandsDock); tabifyDockWidget(ui->presetDock, ui->commandsDock);
@ -153,21 +153,27 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
addDockWidget(Qt::RightDockWidgetArea, ui->featureDock); addDockWidget(Qt::RightDockWidgetArea, ui->featureDock);
ui->inputViewDock->show(); ui->inputViewDock->show();
ui->spectraDisplayDock->show(); ui->spectraControlDock->show();
ui->presetDock->show(); ui->presetDock->show();
ui->commandsDock->show(); ui->commandsDock->show();
ui->channelDock->show(); ui->channelDock->show();
ui->featureDock->show(); ui->featureDock->show();
m_spectrumToggleViewAction = new QAction(tr("Spectrum display"));
m_spectrumToggleViewAction->setCheckable(true);
m_spectrumToggleViewAction->setChecked(true);
connect(m_spectrumToggleViewAction, SIGNAL(toggled(bool)), this, SLOT(toggleSpectrumView(bool)));
ui->menu_Window->addAction(ui->inputViewDock->toggleViewAction()); ui->menu_Window->addAction(ui->inputViewDock->toggleViewAction());
ui->menu_Window->addAction(ui->spectraDisplayDock->toggleViewAction()); ui->menu_Window->addAction(ui->spectraControlDock->toggleViewAction());
ui->menu_Window->addAction(m_spectrumToggleViewAction);
ui->menu_Window->addAction(ui->presetDock->toggleViewAction()); ui->menu_Window->addAction(ui->presetDock->toggleViewAction());
ui->menu_Window->addAction(ui->commandsDock->toggleViewAction()); ui->menu_Window->addAction(ui->commandsDock->toggleViewAction());
ui->menu_Window->addAction(ui->channelDock->toggleViewAction()); ui->menu_Window->addAction(ui->channelDock->toggleViewAction());
ui->menu_Window->addAction(ui->featureDock->toggleViewAction()); ui->menu_Window->addAction(ui->featureDock->toggleViewAction());
ui->spectraDisplayDock->setStyleSheet("QAbstractButton#qt_dockwidget_closebutton{qproperty-toolTip: \"Close\";}"); ui->spectraControlDock->setStyleSheet("QAbstractButton#qt_dockwidget_closebutton{qproperty-toolTip: \"Close\";}");
ui->spectraDisplayDock->setStyleSheet("QAbstractButton#qt_dockwidget_floatbutton{qproperty-toolTip: \"Dock/undock\";}"); ui->spectraControlDock->setStyleSheet("QAbstractButton#qt_dockwidget_floatbutton{qproperty-toolTip: \"Dock/undock\";}");
ui->presetDock->setStyleSheet("QAbstractButton#qt_dockwidget_closebutton{qproperty-toolTip: \"Close\";}"); ui->presetDock->setStyleSheet("QAbstractButton#qt_dockwidget_closebutton{qproperty-toolTip: \"Close\";}");
ui->presetDock->setStyleSheet("QAbstractButton#qt_dockwidget_floatbutton{qproperty-toolTip: \"Dock/undock\";}"); ui->presetDock->setStyleSheet("QAbstractButton#qt_dockwidget_floatbutton{qproperty-toolTip: \"Dock/undock\";}");
@ -323,6 +329,7 @@ MainWindow::~MainWindow()
removeAllFeatureSets(); removeAllFeatureSets();
delete ui; delete ui;
delete m_spectrumToggleViewAction;
qDebug() << "MainWindow::~MainWindow: end"; qDebug() << "MainWindow::~MainWindow: end";
delete m_commandKeyReceiver; delete m_commandKeyReceiver;
@ -788,6 +795,8 @@ void MainWindow::loadPresetSettings(const Preset* preset, int tabIndex)
} }
} }
m_spectrumToggleViewAction->setChecked(preset->getShowSpectrum());
// has to be last step // has to be last step
if (!preset->getLayout().isEmpty()) { if (!preset->getLayout().isEmpty()) {
restoreState(preset->getLayout()); restoreState(preset->getLayout());
@ -832,6 +841,7 @@ void MainWindow::savePresetSettings(Preset* preset, int tabIndex)
deviceUI->m_deviceAPI->saveSamplingDeviceSettings(preset); deviceUI->m_deviceAPI->saveSamplingDeviceSettings(preset);
} }
preset->setShowSpectrum(m_spectrumToggleViewAction->isChecked());
preset->setLayout(saveState()); preset->setLayout(saveState());
} }
@ -1912,6 +1922,15 @@ void MainWindow::fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exi
m_fftWisdomProcess = nullptr; m_fftWisdomProcess = nullptr;
} }
void MainWindow::toggleSpectrumView(bool checked)
{
if (checked) {
ui->centralWidget->show();
} else {
ui->centralWidget->hide();
}
}
void MainWindow::on_action_AMBE_triggered() void MainWindow::on_action_AMBE_triggered()
{ {
qDebug("MainWindow::on_action_AMBE_triggered"); qDebug("MainWindow::on_action_AMBE_triggered");

View File

@ -117,6 +117,7 @@ private:
WebAPIAdapter *m_apiAdapter; WebAPIAdapter *m_apiAdapter;
QString m_apiHost; QString m_apiHost;
int m_apiPort; int m_apiPort;
QAction *m_spectrumToggleViewAction;
CommandKeyReceiver *m_commandKeyReceiver; CommandKeyReceiver *m_commandKeyReceiver;
@ -200,6 +201,7 @@ private slots:
void tabFeaturesIndexChanged(); void tabFeaturesIndexChanged();
void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release); void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release);
void fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void toggleSpectrumView(bool checked);
}; };
#endif // INCLUDE_MAINWINDOW_H #endif // INCLUDE_MAINWINDOW_H

View File

@ -64,7 +64,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1012</width> <width>1012</width>
<height>20</height> <height>27</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
@ -193,9 +193,9 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QDockWidget" name="spectraDisplayDock"> <widget class="QDockWidget" name="spectraControlDock">
<property name="windowTitle"> <property name="windowTitle">
<string>Spectrum Display</string> <string>Spectrum Control</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>

View File

@ -49,7 +49,8 @@ The following items are presented hierarchically from left to right:
- Window: presents the list of dockable windows. Check to make it visible. Uncheck to hide. These windows are: - Window: presents the list of dockable windows. Check to make it visible. Uncheck to hide. These windows are:
- _Sampling devices control_: control of which sampling devices is used and add channels - _Sampling devices control_: control of which sampling devices is used and add channels
- _Sampling devices_: the sampling devices UIs - _Sampling devices_: the sampling devices UIs
- _Spectrum display_: the main spectrum displays (output from the sampling devices) - _Spectrum control_: the main spectrum displays control
- _Spectrum display_: the main spectrum displays. Note this is not a dockable window but occupies the central widget
- _Presets_: the saved presets - _Presets_: the saved presets
- _Commands_: the defined commands - _Commands_: the defined commands
- _Channels_: the channels active for each device - _Channels_: the channels active for each device