From bc75ca7735fa11a6c65d9c682a2f0275603390cb Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 6 Dec 2016 00:25:59 +0100 Subject: [PATCH] Level meter embellishment --- plugins/channelrx/demodam/amdemodgui.cpp | 2 +- plugins/channelrx/demodam/amdemodgui.ui | 10 ++++-- plugins/channelrx/demodnfm/nfmdemodgui.ui | 10 ++++-- plugins/channeltx/modam/ammodgui.ui | 28 ++++++----------- plugins/channeltx/modnfm/nfmmodgui.ui | 10 ++++-- sdrbase/gui/levelmeter.cpp | 37 +++++++++++++++-------- 6 files changed, 58 insertions(+), 39 deletions(-) diff --git a/plugins/channelrx/demodam/amdemodgui.cpp b/plugins/channelrx/demodam/amdemodgui.cpp index ff39731d4..d414fd207 100644 --- a/plugins/channelrx/demodam/amdemodgui.cpp +++ b/plugins/channelrx/demodam/amdemodgui.cpp @@ -235,7 +235,7 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); - ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenYellow); + ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); //m_channelMarker = new ChannelMarker(this); m_channelMarker.setColor(Qt::yellow); diff --git a/plugins/channelrx/demodam/amdemodgui.ui b/plugins/channelrx/demodam/amdemodgui.ui index 58a3ed91f..9a7e8ec1f 100644 --- a/plugins/channelrx/demodam/amdemodgui.ui +++ b/plugins/channelrx/demodam/amdemodgui.ui @@ -10,9 +10,15 @@ 170 + + + 0 + 0 + + - 302 + 0 0 @@ -197,7 +203,7 @@ - Level meter (dB) light: average, dark: peak, tip: peak hold + Level meter (dB) top trace: average, bottom trace: instantaneous peak, tip: peak hold diff --git a/plugins/channelrx/demodnfm/nfmdemodgui.ui b/plugins/channelrx/demodnfm/nfmdemodgui.ui index 68f931063..7175638e6 100644 --- a/plugins/channelrx/demodnfm/nfmdemodgui.ui +++ b/plugins/channelrx/demodnfm/nfmdemodgui.ui @@ -10,9 +10,15 @@ 178 + + + 0 + 0 + + - 302 + 0 0 @@ -179,7 +185,7 @@ - Level meter (dB) light: average, dark: peak, tip: peak hold + Level meter (dB) top trace: average, bottom trace: instantaneous peak, tip: peak hold diff --git a/plugins/channeltx/modam/ammodgui.ui b/plugins/channeltx/modam/ammodgui.ui index baa8e302b..74d1a2f84 100644 --- a/plugins/channeltx/modam/ammodgui.ui +++ b/plugins/channeltx/modam/ammodgui.ui @@ -10,9 +10,15 @@ 195 + + + 0 + 0 + + - 290 + 0 0 @@ -50,16 +56,7 @@ 3 - - 2 - - - 2 - - - 2 - - + 2 @@ -287,13 +284,6 @@ - - - - Qt::Vertical - - - @@ -365,7 +355,7 @@ - Volume meter. White line is 100% and shoul not be exceeded (red zone) + Level (% full range) top trace: average, bottom trace: instantaneous peak, tip: peak hold diff --git a/plugins/channeltx/modnfm/nfmmodgui.ui b/plugins/channeltx/modnfm/nfmmodgui.ui index b5096a3d7..b86d3f03e 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.ui +++ b/plugins/channeltx/modnfm/nfmmodgui.ui @@ -10,9 +10,15 @@ 182 + + + 0 + 0 + + - 290 + 0 0 @@ -389,7 +395,7 @@ - Volume meter. White line is 100% and shoul not be exceeded (red zone) + Level (% full range) top trace: average, bottom trace: instantaneous peak, tip: peak hold diff --git a/sdrbase/gui/levelmeter.cpp b/sdrbase/gui/levelmeter.cpp index 80da4b14b..e502fe988 100644 --- a/sdrbase/gui/levelmeter.cpp +++ b/sdrbase/gui/levelmeter.cpp @@ -65,9 +65,9 @@ LevelMeter::LevelMeter(QWidget *parent) , m_peakDecayRate(PeakDecayRate) , m_peakHoldLevel(0.0) , m_redrawTimer(new QTimer(this)) - , m_avgColor(0x97, 0x54, 0x00, 128) // color mapper 59% - , m_decayedPeakColor(0xff, 0x8b, 0x00, 128) // color mapper foreground - , m_peakColor(255, 0, 0, 128) // just red + , m_avgColor(0xff, 0x8b, 0x00, 128) // color mapper foreground + , m_decayedPeakColor(0x97, 0x54, 0x00, 128) // color mapper 59% + , m_peakColor(Qt::red) // just red 100% opaque , m_backgroundPixmap(0) { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); @@ -221,18 +221,24 @@ void LevelMeterVU::render(QPainter *painter) // Bottom moving gauge bar.setTop(0.5 * rect().height() + 2); - bar.setBottom(rect().height() - 3); + bar.setBottom(rect().height() - 1); bar.setRight(rect().right() - (1.0 - 0.75*m_peakHoldLevel) * rect().width()); - bar.setLeft(bar.right() - 5); + bar.setLeft(bar.right() - 2); painter->fillRect(bar, m_peakColor); - bar.setLeft(rect().left()); + + bar.setBottom(0.75*rect().height()); + + bar.setRight(rect().right() - (1.0 - 0.75*m_avgLevel) * rect().width()); + bar.setLeft(1); + painter->fillRect(bar, m_avgColor); + + bar.setTop(0.75 * rect().height() + 1); + bar.setBottom(rect().height() - 1); bar.setRight(rect().right() - (1.0 - 0.75*m_decayedPeakLevel) * rect().width()); painter->fillRect(bar, m_decayedPeakColor); - bar.setRight(rect().right() - (1.0 - 0.75*m_avgLevel) * rect().width()); - painter->fillRect(bar, m_avgColor); } // ==================================================================== @@ -325,18 +331,23 @@ void LevelMeterSignalDB::render(QPainter *painter) // Bottom moving gauge bar.setTop(0.5 * rect().height() + 2); - bar.setBottom(rect().height() - 3); + bar.setBottom(rect().height() - 1); + + bar.setRight(rect().right() - (1.0 - m_peakHoldLevel) * rect().width()); + bar.setLeft(bar.right() - 2); + painter->fillRect(bar, m_peakColor[m_colorTheme]); + + bar.setBottom(0.75*rect().height()); bar.setRight(rect().right() - (1.0 - m_avgLevel) * rect().width()); bar.setLeft(1); painter->fillRect(bar, m_avgColor[m_colorTheme]); + bar.setTop(0.75 * rect().height() + 1); + bar.setBottom(rect().height() - 1); + bar.setRight(rect().right() - (1.0 - m_decayedPeakLevel) * rect().width()); - bar.setLeft(rect().right() - (1.0 - m_avgLevel) * rect().width()); painter->fillRect(bar, m_decayedPeakColor[m_colorTheme]); - bar.setRight(rect().right() - (1.0 - m_peakHoldLevel) * rect().width()); - bar.setLeft(bar.right() - 2); - painter->fillRect(bar, m_peakColor[m_colorTheme]); }