1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

Level meter embellishment

This commit is contained in:
f4exb 2016-12-06 00:25:59 +01:00
parent e6667c88eb
commit bc75ca7735
6 changed files with 58 additions and 39 deletions

View File

@ -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);

View File

@ -10,9 +10,15 @@
<height>170</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>302</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -197,7 +203,7 @@
</size>
</property>
<property name="toolTip">
<string>Level meter (dB) light: average, dark: peak, tip: peak hold</string>
<string>Level meter (dB) top trace: average, bottom trace: instantaneous peak, tip: peak hold</string>
</property>
</widget>
</item>

View File

@ -10,9 +10,15 @@
<height>178</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>302</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -179,7 +185,7 @@
</size>
</property>
<property name="toolTip">
<string>Level meter (dB) light: average, dark: peak, tip: peak hold</string>
<string>Level meter (dB) top trace: average, bottom trace: instantaneous peak, tip: peak hold</string>
</property>
</widget>
</item>

View File

@ -10,9 +10,15 @@
<height>195</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>290</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -50,16 +56,7 @@
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>
@ -287,13 +284,6 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -365,7 +355,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Volume meter. White line is 100% and shoul not be exceeded (red zone)</string>
<string>Level (% full range) top trace: average, bottom trace: instantaneous peak, tip: peak hold</string>
</property>
</widget>
</item>

View File

@ -10,9 +10,15 @@
<height>182</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>290</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -389,7 +395,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Volume meter. White line is 100% and shoul not be exceeded (red zone)</string>
<string>Level (% full range) top trace: average, bottom trace: instantaneous peak, tip: peak hold</string>
</property>
</widget>
</item>

View File

@ -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]);
}