Implemented Tx spectrum display in main window for future use

pull/6/head
f4exb 2015-10-03 03:56:03 +02:00
rodzic cf9263f1ff
commit c46741bd72
3 zmienionych plików z 73 dodań i 49 usunięć

Wyświetl plik

@ -77,7 +77,8 @@ private:
MainSettings m_settings; MainSettings m_settings;
SpectrumVis* m_spectrumVis; SpectrumVis* m_rxSpectrumVis;
SpectrumVis* m_txSpectrumVis;
FileSink *m_fileSink; FileSink *m_fileSink;
DSPEngine* m_dspEngine; DSPEngine* m_dspEngine;

Wyświetl plik

@ -58,7 +58,6 @@ MainWindow::MainWindow(QWidget* parent) :
m_dspEngine->start(); m_dspEngine->start();
ui->setupUi(this); ui->setupUi(this);
delete ui->mainToolBar;
createStatusBar(); createStatusBar();
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
@ -68,21 +67,21 @@ MainWindow::MainWindow(QWidget* parent) :
// work around broken Qt dock widget ordering // work around broken Qt dock widget ordering
removeDockWidget(ui->inputDock); removeDockWidget(ui->inputDock);
removeDockWidget(ui->rxDisplayDock); removeDockWidget(ui->spectraDisplayDock);
removeDockWidget(ui->presetDock); removeDockWidget(ui->presetDock);
removeDockWidget(ui->channelDock); removeDockWidget(ui->channelDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->inputDock); addDockWidget(Qt::LeftDockWidgetArea, ui->inputDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->rxDisplayDock); addDockWidget(Qt::LeftDockWidgetArea, ui->spectraDisplayDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock); addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock);
addDockWidget(Qt::RightDockWidgetArea, ui->channelDock); addDockWidget(Qt::RightDockWidgetArea, ui->channelDock);
ui->inputDock->show(); ui->inputDock->show();
ui->rxDisplayDock->show(); ui->spectraDisplayDock->show();
ui->presetDock->show(); ui->presetDock->show();
ui->channelDock->show(); ui->channelDock->show();
ui->menu_Window->addAction(ui->inputDock->toggleViewAction()); ui->menu_Window->addAction(ui->inputDock->toggleViewAction());
ui->menu_Window->addAction(ui->rxDisplayDock->toggleViewAction()); ui->menu_Window->addAction(ui->spectraDisplayDock->toggleViewAction());
ui->menu_Window->addAction(ui->presetDock->toggleViewAction()); ui->menu_Window->addAction(ui->presetDock->toggleViewAction());
ui->menu_Window->addAction(ui->channelDock->toggleViewAction()); ui->menu_Window->addAction(ui->channelDock->toggleViewAction());
@ -101,10 +100,19 @@ MainWindow::MainWindow(QWidget* parent) :
m_pluginManager->fillSampleSourceSelector(ui->sampleSource); m_pluginManager->fillSampleSourceSelector(ui->sampleSource);
ui->sampleSource->blockSignals(sampleSourceSignalsBlocked); ui->sampleSource->blockSignals(sampleSourceSignalsBlocked);
m_spectrumVis = new SpectrumVis(ui->glSpectrum); // Disable Tx spectrum by default. Enabled if source supports Tx.
ui->glSpectrum->connectTimer(m_masterTimer); ui->tabSpectra->setTabEnabled(1, false);
ui->glSpectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); ui->tabSpectraGUI->setTabEnabled(1, false);
m_dspEngine->addSink(m_spectrumVis);
m_rxSpectrumVis = new SpectrumVis(ui->rxSpectrum);
ui->rxSpectrum->connectTimer(m_masterTimer);
ui->rxSpectrumGUI->setBuddies(m_rxSpectrumVis->getInputMessageQueue(), m_rxSpectrumVis, ui->rxSpectrum);
m_dspEngine->addSink(m_rxSpectrumVis);
m_txSpectrumVis = new SpectrumVis(ui->txSpectrum);
ui->txSpectrum->connectTimer(m_masterTimer);
ui->txSpectrumGUI->setBuddies(m_txSpectrumVis->getInputMessageQueue(), m_txSpectrumVis, ui->txSpectrum);
//m_dspEngine->addSink(m_rxSpectrumVis);
m_fileSink = new FileSink(); m_fileSink = new FileSink();
m_dspEngine->addSink(m_fileSink); m_dspEngine->addSink(m_fileSink);
@ -149,9 +157,9 @@ MainWindow::~MainWindow()
m_pluginManager->freeAll(); m_pluginManager->freeAll();
m_dspEngine->removeSink(m_fileSink); m_dspEngine->removeSink(m_fileSink);
m_dspEngine->removeSink(m_spectrumVis); m_dspEngine->removeSink(m_rxSpectrumVis);
delete m_fileSink; delete m_fileSink;
delete m_spectrumVis; delete m_rxSpectrumVis;
delete m_pluginManager; delete m_pluginManager;
m_dspEngine->stop(); m_dspEngine->stop();
@ -178,12 +186,12 @@ void MainWindow::addViewAction(QAction* action)
void MainWindow::addChannelMarker(ChannelMarker* channelMarker) void MainWindow::addChannelMarker(ChannelMarker* channelMarker)
{ {
ui->glSpectrum->addChannelMarker(channelMarker); ui->rxSpectrum->addChannelMarker(channelMarker);
} }
void MainWindow::removeChannelMarker(ChannelMarker* channelMarker) void MainWindow::removeChannelMarker(ChannelMarker* channelMarker)
{ {
ui->glSpectrum->removeChannelMarker(channelMarker); ui->rxSpectrum->removeChannelMarker(channelMarker);
} }
void MainWindow::setInputGUI(QWidget* gui) void MainWindow::setInputGUI(QWidget* gui)
@ -213,7 +221,7 @@ void MainWindow::loadPresetSettings(const Preset* preset)
qPrintable(preset->getGroup()), qPrintable(preset->getGroup()),
qPrintable(preset->getDescription())); qPrintable(preset->getDescription()));
ui->glSpectrumGUI->deserialize(preset->getSpectrumConfig()); ui->rxSpectrumGUI->deserialize(preset->getSpectrumConfig());
m_pluginManager->loadSettings(preset); m_pluginManager->loadSettings(preset);
// has to be last step // has to be last step
@ -234,7 +242,7 @@ void MainWindow::savePresetSettings(Preset* preset)
qPrintable(preset->getGroup()), qPrintable(preset->getGroup()),
qPrintable(preset->getDescription())); qPrintable(preset->getDescription()));
preset->setSpectrumConfig(ui->glSpectrumGUI->serialize()); preset->setSpectrumConfig(ui->rxSpectrumGUI->serialize());
preset->clearChannels(); preset->clearChannels();
m_pluginManager->saveSettings(preset); m_pluginManager->saveSettings(preset);
@ -270,12 +278,12 @@ void MainWindow::closeEvent(QCloseEvent*)
void MainWindow::updateCenterFreqDisplay() void MainWindow::updateCenterFreqDisplay()
{ {
ui->glSpectrum->setCenterFrequency(m_centerFrequency); ui->rxSpectrum->setCenterFrequency(m_centerFrequency);
} }
void MainWindow::updateSampleRate() void MainWindow::updateSampleRate()
{ {
ui->glSpectrum->setSampleRate(m_sampleRate); ui->rxSpectrum->setSampleRate(m_sampleRate);
m_sampleRateWidget->setText(tr("Rate: %1 kHz").arg((float)m_sampleRate / 1000)); m_sampleRateWidget->setText(tr("Rate: %1 kHz").arg((float)m_sampleRate / 1000));
} }

Wyświetl plik

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1012</width> <width>1012</width>
<height>600</height> <height>605</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -35,19 +35,34 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="GLSpectrum" name="glSpectrum" native="true"> <widget class="QTabWidget" name="tabSpectra">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font"> <property name="font">
<font> <font>
<family>Monospace</family>
<pointsize>8</pointsize> <pointsize>8</pointsize>
</font> </font>
</property> </property>
<property name="tabPosition">
<enum>QTabWidget::East</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<widget class="GLSpectrum" name="rxSpectrum">
<attribute name="title">
<string>Rx</string>
</attribute>
</widget>
<widget class="GLSpectrum" name="txSpectrum">
<attribute name="title">
<string>Tx</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -110,14 +125,6 @@
<addaction name="menu_Window"/> <addaction name="menu_Window"/>
<addaction name="menu_Help"/> <addaction name="menu_Help"/>
</widget> </widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
<widget class="QDockWidget" name="presetDock"> <widget class="QDockWidget" name="presetDock">
<property name="windowTitle"> <property name="windowTitle">
@ -289,9 +296,9 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QDockWidget" name="rxDisplayDock"> <widget class="QDockWidget" name="spectraDisplayDock">
<property name="windowTitle"> <property name="windowTitle">
<string>Rx Display</string> <string>Spectrum Display</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>
@ -320,7 +327,26 @@
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="GLSpectrumGUI" name="glSpectrumGUI" native="true"/> <widget class="QTabWidget" name="tabSpectraGUI">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="GLSpectrumGUI" name="rxSpectrumGUI">
<attribute name="title">
<string>Rx</string>
</attribute>
</widget>
<widget class="GLSpectrumGUI" name="txSpectrumGUI">
<attribute name="title">
<string>Tx</string>
</attribute>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -392,17 +418,6 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="action_Exit"> <action name="action_Exit">
<property name="text"> <property name="text">
<string>E&amp;xit</string> <string>E&amp;xit</string>