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

QML: Add support for selecting/loading effects #4000

Merged
merged 26 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8cab623
QML: Add EffectManager proxy and visibleEffectModel
Holzhaus Jun 15, 2021
9a797ee
skins/QMLDemo: Use actual visibleEffectList from EffectManager
Holzhaus Jun 15, 2021
2b9f3e2
QML: Add a way to load effects via effect manager
Holzhaus Jun 15, 2021
dea4f22
skins/QMLDemo: Enable switching effects via comboboxes
Holzhaus Jun 15, 2021
5855308
QML: Add QmlEffectSlotProxy
Holzhaus Jun 15, 2021
58ed35d
skins/QMLDemo: Listen to effect changes via COs and update ComboBox
Holzhaus Jun 15, 2021
79e555b
skins/QMLDemo: Move EffectSlot to separate file
Holzhaus Jun 20, 2021
2d0234e
skins/QMLDemo: Ensure that the correct effect is selected after start
Holzhaus Jun 20, 2021
9e7756e
skins/QMLDemo: Make EffectUnit expandable
Holzhaus Jun 20, 2021
8775193
QML: Expose Effect slot parameters as model
Holzhaus Jun 21, 2021
66e33f2
skin/QMLDemo: Display EffectSlot parameters using ListView
Holzhaus Jun 21, 2021
7098d11
Merge branch 'main' of github.com:mixxxdj/mixxx into qml-effects
Holzhaus Jun 21, 2021
7486a67
skins/QMLDemo: Fix broken EffectUnit bg when single unit is expanded
Holzhaus Jun 21, 2021
534df61
skins/QMLDemo: Use actual type instead var for property declaration
Holzhaus Jun 21, 2021
8b5eeef
skins/QMLDemo: Remove obsolete TODO comment
Holzhaus Jun 21, 2021
aa271d8
QML: Add TODO for enum usage to QmlEffectManifestParametersModel
Holzhaus Jun 21, 2021
93dec8e
skins/QMLDemo: Use JS template strings instead of concatenation
Holzhaus Jun 21, 2021
c8cb59a
skins/QMLDemo: Fix MiniKnob indicator and reduce duplication
Holzhaus Jun 21, 2021
f58eabc
skins/QMLDemo: Use fixed width for knob indicator
Holzhaus Jun 21, 2021
ae7408f
skins/QMLDemo: Fix label for FX parameters where shortName is not set
Holzhaus Jun 21, 2021
c20b1e2
skins/QMLDemo: Increase effect parameter width to prevent elided text
Holzhaus Jun 21, 2021
fdb46c0
skins/QMLDemo: Add TODO regarding null coalescing
Holzhaus Jun 22, 2021
77650d1
skins/QMLDemo: Make effect param buttons toggleable and add label
Holzhaus Jun 22, 2021
3265842
skins/QMLDemo: Show dryWet/superKnob only when EffectUnit is expanded
Holzhaus Jun 22, 2021
a99bd50
QML: Add a way to retrieve the Effect parameter control key from model
Holzhaus Jun 22, 2021
c8cfefa
skins/QMLDemo: Fix wrong effect parameter control keys
Holzhaus Jun 22, 2021
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
15 changes: 7 additions & 8 deletions res/skins/QMLDemo/EffectSlot.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "Theme"
Item {
id: root

property var slot: Mixxx.EffectsManager.getEffectSlot(1, unitNumber, effectNumber)
property Mixxx.EffectSlotProxy slot: Mixxx.EffectsManager.getEffectSlot(1, unitNumber, effectNumber)
property int unitNumber // required
property int effectNumber // required
property bool expanded: false
Expand Down Expand Up @@ -46,7 +46,6 @@ Item {
anchors.left: effectEnableButton.right
anchors.right: effectMetaKnob.left
anchors.margins: 5
// TODO: Add a way to retrieve effect names here
textRole: "display"
model: Mixxx.EffectsManager.visibleEffectsModel
onActivated: {
Expand Down Expand Up @@ -100,7 +99,7 @@ Item {
anchors.left: selector.right
anchors.right: parent.right
anchors.bottom: parent.bottom
clip: false
clip: true
spacing: 5
model: root.slot.parametersModel
orientation: ListView.Horizontal
Expand All @@ -109,17 +108,17 @@ Item {
id: parameter

property int number: index + 1
property string name: shortName
property string label: shortName ? shortName : name
Holzhaus marked this conversation as resolved.
Show resolved Hide resolved
property bool isButton: controlHint > 0 && controlHint == 6
property bool isKnob: controlHint > 0 && controlHint < 6

width: 40
width: 50
height: 50

EmbeddedText {
anchors.fill: parent
verticalAlignment: Text.AlignBottom
text: parameter.name
text: parameter.label
font.bold: false
}

Expand All @@ -141,7 +140,7 @@ Item {
property bool loaded: value != 0

group: root.group
key: "parameter" + parameter.number + "_loaded"
key: `parameter${parameter.number}_loaded`
}

}
Expand All @@ -163,7 +162,7 @@ Item {
property bool loaded: value != 0

group: root.group
key: "button_parameter" + parameter.number + "_loaded"
key: `button_parameter${parameter.number}_loaded`
}

}
Expand Down
12 changes: 6 additions & 6 deletions res/skins/QMLDemo/Knob.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ MixxxControls.Knob {
id: root

property color color // required
property url shadowSource: Theme.imgKnobShadow
property url backgroundSource: Theme.imgKnob

implicitWidth: background.width
implicitHeight: implicitWidth
Expand All @@ -24,7 +26,7 @@ MixxxControls.Knob {
anchors.right: parent.right
height: width * 7 / 6
fillMode: Image.PreserveAspectFit
source: Theme.imgKnobShadow
source: root.shadowSource
}

background: Image {
Expand All @@ -34,21 +36,19 @@ MixxxControls.Knob {
anchors.left: parent.left
anchors.right: parent.right
height: width
source: Theme.imgKnob
source: root.backgroundSource
}

foreground: Item {
id: inidicator

anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: width

Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: root.width / 30
height: 10
width: 2
height: root.width / 5
y: height
color: root.color
}
Expand Down
55 changes: 4 additions & 51 deletions res/skins/QMLDemo/MiniKnob.qml
Original file line number Diff line number Diff line change
@@ -1,56 +1,9 @@
import Mixxx.Controls 0.1 as MixxxControls
import QtQuick 2.12
import "." as Skin
import "Theme"

MixxxControls.Knob {
Skin.Knob {
id: root

property color color // required

implicitWidth: background.width
implicitHeight: implicitWidth
arc: true
arcRadius: width * 0.45
arcOffsetY: width * 0.01
arcColor: root.color
arcWidth: 2
angle: 116

Image {
id: shadow

anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: width * 7 / 6
fillMode: Image.PreserveAspectFit
source: Theme.imgKnobMiniShadow
}

background: Image {
id: background

anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: width
source: Theme.imgKnobMini
}

foreground: Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: width

Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: root.width / 30
height: 10
y: height
color: root.color
}

}

shadowSource: Theme.imgKnobMiniShadow
backgroundSource: Theme.imgKnobMini
}
2 changes: 2 additions & 0 deletions src/skin/qml/qmleffectmanifestparametersmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ QVariant QmlEffectManifestParametersModel::data(const QModelIndex& index, int ro
case QmlEffectManifestParametersModel::DescriptionRole:
return pParameter->description();
case QmlEffectManifestParametersModel::ControlHintRole:
// TODO: Remove this cast, instead expose the enum directly using
// Q_ENUM after #2618 has been merged.
return static_cast<int>(pParameter->controlHint());
default:
return QVariant();
Expand Down