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 SyncButton component with leader support #4068

Merged
merged 1 commit into from
Jul 7, 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
6 changes: 1 addition & 5 deletions res/skins/QMLDemo/Deck.qml
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,12 @@ Item {

}

Skin.ControlButton {
Skin.SyncButton {
id: syncButton

anchors.right: parent.right
anchors.top: parent.top
text: "Sync"
group: root.group
key: "sync_enabled"
toggleable: true
activeColor: Theme.deckActiveColor
}

FadeBehavior on visible {
Expand Down
70 changes: 70 additions & 0 deletions res/skins/QMLDemo/SyncButton.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import "." as Skin
import Mixxx 0.1 as Mixxx
import "Theme"

Skin.Button {
id: root

enum SyncMode {
Off,
Follower,
ImplicitLeader,
ExplicitLeader
}

property string group // required
property alias mode: modeControl.value

function toggleSync() {
enabledControl.value = !enabledControl.value;
}

function toggleLeader() {
leaderControl.value = !leaderControl.value;
}

activeColor: {
switch (mode) {
case SyncButton.SyncMode.ImplicitLeader:
return Theme.yellow;
case SyncButton.SyncMode.ExplicitLeader:
return Theme.red;
default:
return Theme.deckActiveColor;
}
}
text: {
switch (mode) {
case SyncButton.SyncMode.ImplicitLeader:
case SyncButton.SyncMode.ExplicitLeader:
return "Leader";
default:
return "Sync";
}
}
highlight: enabledControl.value
onClicked: toggleSync()
onPressAndHold: toggleLeader()

Mixxx.ControlProxy {
id: enabledControl

group: root.group
key: "sync_enabled"
}

Mixxx.ControlProxy {
id: modeControl

group: root.group
key: "sync_mode"
}

Mixxx.ControlProxy {
id: leaderControl

group: root.group
key: "sync_master"
}

}