mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	Main Window: added option to hide or show the main spectrum in the central widget. Fixes #1152
This commit is contained in:
		
							parent
							
								
									dc9c60d48e
								
							
						
					
					
						commit
						8e79cd7ff2
					
				
										
											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.
										
									
								
							| @ -36,6 +36,7 @@ Preset::Preset(const Preset& other) : | ||||
| 	m_iqImbalanceCorrection(other.m_iqImbalanceCorrection), | ||||
| 	m_channelConfigs(other.m_channelConfigs), | ||||
| 	m_deviceConfigs(other.m_deviceConfigs), | ||||
| 	m_showSpectrum(other.m_showSpectrum), | ||||
| 	m_layout(other.m_layout) | ||||
| {} | ||||
| 
 | ||||
| @ -50,6 +51,7 @@ void Preset::resetToDefaults() | ||||
| 	m_channelConfigs.clear(); | ||||
| 	m_dcOffsetCorrection = false; | ||||
| 	m_iqImbalanceCorrection = false; | ||||
| 	m_showSpectrum = true; | ||||
| } | ||||
| 
 | ||||
| QByteArray Preset::serialize() const | ||||
| @ -69,6 +71,7 @@ QByteArray Preset::serialize() const | ||||
| 	s.writeBlob(5, m_spectrumConfig); | ||||
|     s.writeBool(6, m_presetType == PresetSource); | ||||
| 	s.writeS32(7, (int) m_presetType); | ||||
| 	s.writeBool(8, m_showSpectrum); | ||||
| 
 | ||||
| 	s.writeS32(20, m_deviceConfigs.size()); | ||||
| 
 | ||||
| @ -126,6 +129,7 @@ bool Preset::deserialize(const QByteArray& data) | ||||
| 		d.readBlob(5, &m_spectrumConfig); | ||||
| 		d.readBool(6, &tmpBool, true); | ||||
|         d.readS32(7, &tmp, PresetSource); | ||||
| 		d.readBool(8, &m_showSpectrum, true); | ||||
|         m_presetType = tmp < (int) PresetSource ? PresetSource : tmp > (int) PresetMIMO ? PresetMIMO : (PresetType) tmp; | ||||
| 
 | ||||
|         if (m_presetType != PresetMIMO) { | ||||
|  | ||||
| @ -96,6 +96,8 @@ public: | ||||
| 	bool hasIQImbalanceCorrection() const { return m_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; } | ||||
| 	const QByteArray& getLayout() const { return m_layout; } | ||||
| 
 | ||||
| @ -164,6 +166,7 @@ protected: | ||||
| 	DeviceeConfigs m_deviceConfigs; | ||||
| 
 | ||||
| 	// screen and dock layout
 | ||||
| 	bool m_showSpectrum; | ||||
| 	QByteArray m_layout; | ||||
| 
 | ||||
| private: | ||||
|  | ||||
| @ -139,13 +139,13 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse | ||||
| 
 | ||||
| 	// work around broken Qt dock widget ordering
 | ||||
|     removeDockWidget(ui->inputViewDock); | ||||
| 	removeDockWidget(ui->spectraDisplayDock); | ||||
| 	removeDockWidget(ui->spectraControlDock); | ||||
| 	removeDockWidget(ui->presetDock); | ||||
|     removeDockWidget(ui->commandsDock); | ||||
| 	removeDockWidget(ui->channelDock); | ||||
|     removeDockWidget(ui->featureDock); | ||||
|     addDockWidget(Qt::LeftDockWidgetArea, ui->inputViewDock); | ||||
| 	addDockWidget(Qt::LeftDockWidgetArea, ui->spectraDisplayDock); | ||||
| 	addDockWidget(Qt::LeftDockWidgetArea, ui->spectraControlDock); | ||||
| 	addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock); | ||||
|     addDockWidget(Qt::LeftDockWidgetArea, ui->commandsDock); | ||||
|     tabifyDockWidget(ui->presetDock, ui->commandsDock); | ||||
| @ -153,21 +153,27 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse | ||||
| 	addDockWidget(Qt::RightDockWidgetArea, ui->featureDock); | ||||
| 
 | ||||
| 	ui->inputViewDock->show(); | ||||
| 	ui->spectraDisplayDock->show(); | ||||
| 	ui->spectraControlDock->show(); | ||||
| 	ui->presetDock->show(); | ||||
| 	ui->commandsDock->show(); | ||||
| 	ui->channelDock->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->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->commandsDock->toggleViewAction()); | ||||
| 	ui->menu_Window->addAction(ui->channelDock->toggleViewAction()); | ||||
|     ui->menu_Window->addAction(ui->featureDock->toggleViewAction()); | ||||
| 
 | ||||
|     ui->spectraDisplayDock->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_closebutton{qproperty-toolTip: \"Close\";}"); | ||||
|     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_floatbutton{qproperty-toolTip: \"Dock/undock\";}"); | ||||
| 
 | ||||
| @ -323,6 +329,7 @@ MainWindow::~MainWindow() | ||||
|     removeAllFeatureSets(); | ||||
| 
 | ||||
| 	delete ui; | ||||
|     delete m_spectrumToggleViewAction; | ||||
| 
 | ||||
| 	qDebug() << "MainWindow::~MainWindow: end"; | ||||
| 	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
 | ||||
|     if (!preset->getLayout().isEmpty()) { | ||||
| 	    restoreState(preset->getLayout()); | ||||
| @ -832,6 +841,7 @@ void MainWindow::savePresetSettings(Preset* preset, int tabIndex) | ||||
|         deviceUI->m_deviceAPI->saveSamplingDeviceSettings(preset); | ||||
|     } | ||||
| 
 | ||||
|     preset->setShowSpectrum(m_spectrumToggleViewAction->isChecked()); | ||||
|     preset->setLayout(saveState()); | ||||
| } | ||||
| 
 | ||||
| @ -1912,6 +1922,15 @@ void MainWindow::fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exi | ||||
|     m_fftWisdomProcess = nullptr; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::toggleSpectrumView(bool checked) | ||||
| { | ||||
|     if (checked) { | ||||
|         ui->centralWidget->show(); | ||||
|     } else { | ||||
|         ui->centralWidget->hide(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_action_AMBE_triggered() | ||||
| { | ||||
|     qDebug("MainWindow::on_action_AMBE_triggered"); | ||||
|  | ||||
| @ -117,6 +117,7 @@ private: | ||||
| 	WebAPIAdapter *m_apiAdapter; | ||||
| 	QString m_apiHost; | ||||
| 	int m_apiPort; | ||||
| 	QAction *m_spectrumToggleViewAction; | ||||
| 
 | ||||
| 	CommandKeyReceiver *m_commandKeyReceiver; | ||||
| 
 | ||||
| @ -200,6 +201,7 @@ private slots: | ||||
| 	void tabFeaturesIndexChanged(); | ||||
| 	void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release); | ||||
| 	void fftWisdomProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); | ||||
| 	void toggleSpectrumView(bool checked); | ||||
| }; | ||||
| 
 | ||||
| #endif // INCLUDE_MAINWINDOW_H
 | ||||
|  | ||||
| @ -64,7 +64,7 @@ | ||||
|      <x>0</x> | ||||
|      <y>0</y> | ||||
|      <width>1012</width> | ||||
|      <height>20</height> | ||||
|      <height>27</height> | ||||
|     </rect> | ||||
|    </property> | ||||
|    <widget class="QMenu" name="menu_File"> | ||||
| @ -193,9 +193,9 @@ | ||||
|     </layout> | ||||
|    </widget> | ||||
|   </widget> | ||||
|   <widget class="QDockWidget" name="spectraDisplayDock"> | ||||
|   <widget class="QDockWidget" name="spectraControlDock"> | ||||
|    <property name="windowTitle"> | ||||
|     <string>Spectrum Display</string> | ||||
|     <string>Spectrum Control</string> | ||||
|    </property> | ||||
|    <attribute name="dockWidgetArea"> | ||||
|     <number>1</number> | ||||
|  | ||||
| @ -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: | ||||
|     - _Sampling devices control_: control of which sampling devices is used and add channels | ||||
|     - _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 | ||||
|     - _Commands_: the defined commands | ||||
|     - _Channels_: the channels active for each device | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user