From e6caa94593752ec6aa6781b9292a615cb1398322 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 1 Aug 2015 03:33:07 +0200 Subject: [PATCH] Use a master timer in the main window to trigger main spectrum instead of spectrum internal timer used by default --- include-gpl/gui/glspectrum.h | 1 + include-gpl/mainwindow.h | 2 ++ sdrbase/gui/glspectrum.cpp | 6 ++++++ sdrbase/mainwindow.cpp | 3 +++ 4 files changed, 12 insertions(+) diff --git a/include-gpl/gui/glspectrum.h b/include-gpl/gui/glspectrum.h index e83277bdf..5ab51a195 100644 --- a/include-gpl/gui/glspectrum.h +++ b/include-gpl/gui/glspectrum.h @@ -58,6 +58,7 @@ public: Real getWaterfallShare() const { return m_waterfallShare; } void setWaterfallShare(Real waterfallShare); + void connectTimer(const QTimer& timer); private: struct ChannelMarkerState { diff --git a/include-gpl/mainwindow.h b/include-gpl/mainwindow.h index 72fff0ec0..7b4521456 100644 --- a/include-gpl/mainwindow.h +++ b/include-gpl/mainwindow.h @@ -61,6 +61,7 @@ public: void removeChannelMarker(ChannelMarker* channelMarker); void setInputGUI(QWidget* gui); + const QTimer& getMasterTimer() const { return m_masterTimer; } private: enum { @@ -81,6 +82,7 @@ private: DSPEngine* m_dspEngine; + QTimer m_masterTimer; QTimer m_statusTimer; int m_lastEngineState; diff --git a/sdrbase/gui/glspectrum.cpp b/sdrbase/gui/glspectrum.cpp index 5c90cd96a..898c808e0 100644 --- a/sdrbase/gui/glspectrum.cpp +++ b/sdrbase/gui/glspectrum.cpp @@ -1543,3 +1543,9 @@ void GLSpectrum::setWaterfallShare(Real waterfallShare) } m_changesPending = true; } + +void GLSpectrum::connectTimer(const QTimer& timer) +{ + disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); + connect(&timer, SIGNAL(timeout()), this, SLOT(tick())); +} diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index bc87890c4..9b829dd38 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -87,6 +87,8 @@ MainWindow::MainWindow(QWidget* parent) : connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); m_statusTimer.start(500); + m_masterTimer.start(50); + m_pluginManager->loadPlugins(); bool sampleSourceSignalsBlocked = ui->sampleSource->blockSignals(true); m_pluginManager->fillSampleSourceSelector(ui->sampleSource); @@ -100,6 +102,7 @@ MainWindow::MainWindow(QWidget* parent) : m_fileSink = new FileSink(); m_dspEngine->addSink(m_fileSink); + ui->glSpectrum->connectTimer(m_masterTimer); ui->glSpectrumGUI->setBuddies(m_dspEngine->getMessageQueue(), m_spectrumVis, ui->glSpectrum); loadSettings();