Sepectrum GUI: use spin boxes for reference level and range with finer steps. Implements issue #546

pull/575/head
f4exb 2020-06-19 00:54:19 +02:00
rodzic bbfece704b
commit fcff673317
4 zmienionych plików z 44 dodań i 68 usunięć

Wyświetl plik

@ -19,6 +19,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QLineEdit>
#include <QToolTip>
#include "gui/glspectrumgui.h"
#include "dsp/fftwindow.h"
#include "dsp/spectrumvis.h"
@ -36,15 +39,18 @@ GLSpectrumGUI::GLSpectrumGUI(QWidget* parent) :
ui->setupUi(this);
on_linscale_toggled(false);
ui->refLevel->clear();
for(int ref = 0; ref >= -110; ref -= 5) {
ui->refLevel->addItem(QString("%1").arg(ref));
}
QString levelStyle = QString(
"QSpinBox {background-color: rgb(79, 79, 79);}"
"QLineEdit {color: white; background-color: rgb(79, 79, 79); border: 1px solid gray; border-radius: 4px;}"
"QTooltip {color: white; background-color: balck;}"
);
ui->refLevel->setStyleSheet(levelStyle);
ui->levelRange->setStyleSheet(levelStyle);
// ui->refLevel->findChild<QLineEdit*>()->setStyleSheet("color: white; background-color: rgb(79, 79, 79); border: 1px solid gray; border-radius: 4px; ");
// ui->refLevel->setStyleSheet("background-color: rgb(79, 79, 79);");
ui->levelRange->clear();
for(int range = 100; range >= 5; range -= 5) {
ui->levelRange->addItem(QString("%1").arg(range));
}
// ui->levelRange->findChild<QLineEdit*>()->setStyleSheet("color: white; background-color: rgb(79, 79, 79); border: 1px solid gray; border-radius: 4px;");
// ui->levelRange->setStyleSheet("background-color: rgb(79, 79, 79);");
connect(&m_messageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
displaySettings();
@ -95,8 +101,8 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data)
void GLSpectrumGUI::displaySettings()
{
blockApplySettings(true);
ui->refLevel->setCurrentIndex(-m_settings.m_refLevel / 5);
ui->levelRange->setCurrentIndex((100 - m_settings.m_powerRange) / 5);
ui->refLevel->setValue(m_settings.m_refLevel);
ui->levelRange->setValue(m_settings.m_powerRange);
ui->decay->setSliderPosition(m_settings.m_decay);
ui->decayDivisor->setSliderPosition(m_settings.m_decayDivisor);
ui->stroke->setSliderPosition(m_settings.m_histogramStroke);
@ -242,15 +248,15 @@ void GLSpectrumGUI::on_linscale_toggled(bool checked)
applySettings();
}
void GLSpectrumGUI::on_refLevel_currentIndexChanged(int index)
void GLSpectrumGUI::on_refLevel_valueChanged(int value)
{
m_settings.m_refLevel = 0 - index * 5;
m_settings.m_refLevel = value;
applySettings();
}
void GLSpectrumGUI::on_levelRange_currentIndexChanged(int index)
void GLSpectrumGUI::on_levelRange_valueChanged(int value)
{
m_settings.m_powerRange = 100 - index * 5;
m_settings.m_powerRange = value;
applySettings();
}

Wyświetl plik

@ -83,8 +83,8 @@ private:
private slots:
void on_fftWindow_currentIndexChanged(int index);
void on_fftSize_currentIndexChanged(int index);
void on_refLevel_currentIndexChanged(int index);
void on_levelRange_currentIndexChanged(int index);
void on_refLevel_valueChanged(int value);
void on_levelRange_valueChanged(int value);
void on_decay_valueChanged(int index);
void on_decayDivisor_valueChanged(int index);
void on_stroke_valueChanged(int index);

Wyświetl plik

@ -453,17 +453,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="refLevel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QSpinBox" name="refLevel">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
<height>24</height>
</size>
</property>
<property name="maximumSize">
@ -475,38 +469,23 @@
<property name="toolTip">
<string>Reference level (dB)</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>-110</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>-5</string>
</property>
</item>
<item>
<property name="text">
<string>-10</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="levelRange">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QSpinBox" name="levelRange">
<property name="minimumSize">
<size>
<width>45</width>
<height>0</height>
<height>24</height>
</size>
</property>
<property name="maximumSize">
@ -518,24 +497,15 @@
<property name="toolTip">
<string>Range (dB)</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<item>
<property name="text">
<string>100</string>
</property>
</item>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
</widget>
</item>
<item>

Wyświetl plik

@ -378,11 +378,11 @@ Select the size of the FFT window among these values:
<h4>4.3. Reference level</h4>
This is the level in dB at the top of the display range. You can select values between 0 and -110 in 5 dB steps
This is the level in dB at the top of the display range. You can select values between 0 and -110 in 1 dB steps
<h4>4.4. Range</h4>
This is the range of display in dB. You can select values between 5 and 100 in 5 dB steps
This is the range of display in dB. You can select values between 1 and 100 in 1 dB steps
<h4>4.5. Averaging mode</h4>