Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skins/QMLDemo: Add channel VU meters #3932

Merged
merged 2 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions res/skins/QMLDemo/MixerColumn.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,41 @@ Item {
color: Theme.gainKnobColor
}

Slider {
id: volumeSlider

Item {
anchors.top: gainKnob.bottom
anchors.topMargin: 5
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: pflButton.top
group: root.group
key: "volume"
barColor: Theme.volumeSliderBarColor
bg: "images/slider_volume.svg"

VuMeter {
x: 15
y: (parent.height - height) / 2
width: 4
height: parent.height - 40
group: root.group
key: "VuMeterL"
}

VuMeter {
x: parent.width - width - 15
y: (parent.height - height) / 2
width: 4
height: parent.height - 40
group: root.group
key: "VuMeterR"
}

Slider {
id: volumeSlider

anchors.fill: parent
group: root.group
key: "volume"
barColor: Theme.volumeSliderBarColor
bg: "images/slider_volume.svg"
}

}

Skin.ControlButton {
Expand Down
84 changes: 84 additions & 0 deletions res/skins/QMLDemo/VuMeter.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import Mixxx 0.1 as Mixxx
import QtGraphicalEffects 1.12
import QtQuick 2.12
import "Theme"

Rectangle {
id: root

property string group // required
property string key // required
property color barColor // required

radius: width / 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for performance reasons, we could consider disabling antialiasing for this Rectangle because i don't think it makes a difference here. https://doc.qt.io/qt-5/qml-qtquick-rectangle.html#performance

color: "black"

Mixxx.ControlProxy {
id: control

group: root.group
key: root.key
}

Item {
id: meterMask

anchors.fill: parent
visible: false

Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 1
antialiasing: false // for performance reasons
height: control.parameter * (parent.height - 2 * anchors.margins)
radius: width / 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same antialiasing performance optimization here.

}

}

Rectangle {
id: meterGradient

antialiasing: false // for performance reasons
anchors.fill: parent
visible: false

gradient: Gradient {
GradientStop {
position: 0.1
color: Theme.red
}

GradientStop {
position: 0.15
color: Theme.yellow
}

GradientStop {
position: 0.25
color: Theme.yellow
}

GradientStop {
position: 0.3
color: Theme.green
}

GradientStop {
position: 1
color: Theme.green
}

}

}

OpacityMask {
anchors.fill: parent
source: meterGradient
maskSource: meterMask
}

}