Changed scope amplitude offset scale and display

This commit is contained in:
f4exb 2015-07-26 10:00:21 +02:00
parent a93aae8ebf
commit c36104708a
2 changed files with 29 additions and 8 deletions

View File

@ -255,11 +255,26 @@ void GLScopeGUI::setAmpScaleDisplay()
void GLScopeGUI::setAmpOfsDisplay()
{
if (m_glScope->getDataMode() == GLScope::ModeMagdBPha) {
ui->ampOfsText->setText(tr("%1\ndB").arg(m_ampOffset - 100.0, 0, 'f', 0));
} else if (m_glScope->getDataMode() == GLScope::ModeMagLinPha) {
ui->ampOfsText->setText(tr("%1").arg(m_ampOffset/200.0, 0, 'f', 3));
} else {
ui->ampOfsText->setText(tr("%1").arg(m_ampOffset/100.0, 0, 'f', 2));
ui->ampOfsText->setText(tr("%1\ndB").arg(m_ampOffset/10.0 - 100.0, 0, 'f', 1));
}
else
{
qreal a;
if (m_glScope->getDataMode() == GLScope::ModeMagLinPha) {
a = m_ampOffset/2000.0;
} else {
a = m_ampOffset/1000.0;
}
if(fabs(a) < 0.000001)
ui->ampOfsText->setText(tr("%1\nn").arg(a * 1000000000.0));
else if(fabs(a) < 0.001)
ui->ampOfsText->setText(tr("%1\nµ").arg(a * 1000000.0));
else if(fabs(a) < 1.0)
ui->ampOfsText->setText(tr("%1\nm").arg(a * 1000.0));
else
ui->ampOfsText->setText(tr("%1").arg(a * 1.0));
}
}
@ -274,7 +289,7 @@ void GLScopeGUI::on_ampOfs_valueChanged(int value)
{
m_ampOffset = value;
setAmpOfsDisplay();
m_glScope->setAmpOfs(value/100.0); // scale to [-1.0,1.0]
m_glScope->setAmpOfs(value/1000.0); // scale to [-1.0,1.0]
}
void GLScopeGUI::on_scope_traceSizeChanged(int)

View File

@ -415,14 +415,20 @@
</item>
<item>
<widget class="QSlider" name="ampOfs">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Y offset</string>
</property>
<property name="minimum">
<number>-100</number>
<number>-1000</number>
</property>
<property name="maximum">
<number>100</number>
<number>1000</number>
</property>
<property name="pageStep">
<number>1</number>