Improve equalizer and fix alignment of label right
This commit is contained in:
parent
984abc89a8
commit
1e886cb12c
@ -21,7 +21,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_1">
|
<widget class="QLabel" name="label_preset">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Preset:</string>
|
<string>Preset:</string>
|
||||||
</property>
|
</property>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="slider_label_layout">
|
<layout class="QHBoxLayout" name="slider_label_layout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_left">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>11</pointsize>
|
<pointsize>11</pointsize>
|
||||||
@ -99,7 +99,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_balance">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Balance</string>
|
<string>Balance</string>
|
||||||
</property>
|
</property>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_right">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>11</pointsize>
|
<pointsize>11</pointsize>
|
||||||
@ -119,7 +119,7 @@
|
|||||||
<string>Right</string>
|
<string>Right</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignBottom</set>
|
<set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -33,15 +33,33 @@ EqualizerSlider::EqualizerSlider(const QString &label, QWidget *parent)
|
|||||||
ui_(new Ui_EqualizerSlider)
|
ui_(new Ui_EqualizerSlider)
|
||||||
{
|
{
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
ui_->label->setText(label);
|
ui_->band->setText(label);
|
||||||
|
|
||||||
|
QFontMetrics fm = ui_->gain->fontMetrics();
|
||||||
|
int longestLabelWidth = fm.width(tr("%1 dB").arg(-99.99));
|
||||||
|
ui_->gain->setMinimumWidth(longestLabelWidth);
|
||||||
|
ui_->gain->setText(tr("%1 dB").arg(0)); // Gain [dB]
|
||||||
|
|
||||||
|
ui_->slider->setValue(0);
|
||||||
|
|
||||||
|
connect(ui_->slider, SIGNAL(valueChanged(int)), this, SLOT(OnValueChanged(int)));
|
||||||
|
|
||||||
connect(ui_->slider, SIGNAL(valueChanged(int)), SIGNAL(ValueChanged(int)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EqualizerSlider::~EqualizerSlider() {
|
EqualizerSlider::~EqualizerSlider() {
|
||||||
delete ui_;
|
delete ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EqualizerSlider::OnValueChanged(int value) {
|
||||||
|
|
||||||
|
// Converting % to dB as per GstEnginePipeline::UpdateEqualizer():
|
||||||
|
float gain = (value < 0) ? value * 0.24 : value * 0.12;
|
||||||
|
|
||||||
|
ui_->gain->setText(tr("%1 dB").arg(gain)); // Gain [dB]
|
||||||
|
emit ValueChanged(value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int EqualizerSlider::value() const {
|
int EqualizerSlider::value() const {
|
||||||
return ui_->slider->value();
|
return ui_->slider->value();
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,9 @@ class EqualizerSlider : public QWidget {
|
|||||||
signals:
|
signals:
|
||||||
void ValueChanged(int value);
|
void ValueChanged(int value);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void OnValueChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_EqualizerSlider *ui_;
|
Ui_EqualizerSlider *ui_;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>36</width>
|
<width>94</width>
|
||||||
<height>224</height>
|
<height>224</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Equalizer</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_1">
|
<spacer name="spacer_left">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -67,7 +67,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="spacer_right">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -82,7 +82,29 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="band">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="gain">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user