1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 05:41:56 -05:00

Put level meter in sunken perspective

This commit is contained in:
f4exb 2017-05-17 00:13:40 +02:00
parent 579c05cfe5
commit 30696762df
2 changed files with 23 additions and 2 deletions

View File

@ -203,7 +203,7 @@ void LevelMeterVU::resized()
painter.drawText(QPointF(tick.textPos - (tick.textSize/2) - 2, bar.height()/2), tick.text);
}
painter.drawLine(tick.pos, 0, scaleTickList[i].pos, bar.height());
painter.drawLine(shiftx(tick.pos, bar.width()), 0, shiftx(scaleTickList[i].pos, bar.width()), bar.height());
}
else
{
@ -239,6 +239,13 @@ void LevelMeterVU::render(QPainter *painter)
bar.setRight(rect().right() - (1.0 - 0.75*m_decayedPeakLevel) * rect().width());
painter->fillRect(bar, m_decayedPeakColor);
// borders
painter->setPen(QColor(0,0,0));
painter->drawLine(0, 0, rect().width() - 2, 0);
painter->drawLine(0, rect().height() - 1, 0, 0);
painter->setPen(QColor(80,80,80));
painter->drawLine(1, rect().height() - 1, rect().width() - 1, rect().height() - 1);
painter->drawLine(rect().width() - 1, rect().height() - 1, rect().width() - 1, 0);
}
// ====================================================================
@ -314,7 +321,7 @@ void LevelMeterSignalDB::resized()
painter.drawText(QPointF(tick.textPos - (tick.textSize/2) - 2, bar.height()/2 - 1), tick.text);
}
painter.drawLine(tick.pos, 0, scaleTickList[i].pos, bar.height());
painter.drawLine(shiftx(tick.pos, bar.width()), 0, shiftx(scaleTickList[i].pos,bar.width()), bar.height());
}
else
{
@ -350,5 +357,13 @@ void LevelMeterSignalDB::render(QPainter *painter)
bar.setRight(rect().right() - (1.0 - m_peakHoldLevel) * rect().width());
bar.setLeft(bar.right() - 2);
painter->fillRect(bar, m_peakColor[m_colorTheme]);
// borders
painter->setPen(QColor(0,0,0));
painter->drawLine(0, 0, rect().width() - 2, 0);
painter->drawLine(0, rect().height() - 1, 0, 0);
painter->setPen(QColor(80,80,80));
painter->drawLine(1, rect().height() - 1, rect().width() - 1, rect().height() - 1);
painter->drawLine(rect().width() - 1, rect().height() - 1, rect().width() - 1, 0);
}

View File

@ -129,6 +129,12 @@ protected:
virtual void render(QPainter *painter) = 0;
virtual void resized() = 0;
/** Shift the x coordinate so it does not fall right on 0 or width-1 */
int shiftx(int val, int width)
{
return val == 0 ? 1 : val == width-1 ? width-2 : val;
}
};
class LevelMeterVU : public LevelMeter