Skip to content

Commit

Permalink
Merge pull request #11407 from acolombier/feat/controller-screen-render
Browse files Browse the repository at this point in the history
feat: controller screen renderer
  • Loading branch information
ywwg committed Jun 3, 2024
2 parents 4d9db3e + d7ce6d8 commit 9b33757
Show file tree
Hide file tree
Showing 42 changed files with 4,347 additions and 302 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug \
-DOPTIMIZE=off \
-DQT6=ON \
-DQML=ON \
-DCOVERAGE=ON \
-DWARNINGS_FATAL=OFF \
-DDEBUG_ASSERTIONS_FATAL=OFF \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
-DMACOS_BUNDLE=ON
-DMODPLUG=ON
-DQT6=ON
-DQML=OFF
-DWAVPACK=ON
-DVCPKG_TARGET_TRIPLET=x64-osx-min1100-release
-DVCPKG_DEFAULT_HOST_TRIPLET=x64-osx-min1100-release
Expand All @@ -71,6 +72,7 @@ jobs:
-DMACOS_BUNDLE=ON
-DMODPLUG=ON
-DQT6=ON
-DQML=OFF
-DWAVPACK=ON
-DVCPKG_TARGET_TRIPLET=arm64-osx-min1100-release
-DVCPKG_DEFAULT_HOST_TRIPLET=x64-osx-min1100-release
Expand Down Expand Up @@ -101,6 +103,7 @@ jobs:
-DMEDIAFOUNDATION=ON
-DMODPLUG=ON
-DQT6=ON
-DQML=OFF
-DWAVPACK=ON
-DVCPKG_TARGET_TRIPLET=x64-windows-release
-DVCPKG_DEFAULT_HOST_TRIPLET=x64-windows-release
Expand Down
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,13 @@ if (NOT QML)
src/control/controlmodel.cpp
src/control/controlsortfiltermodel.cpp
)
else()
target_sources(mixxx-lib PRIVATE
# The following source depends of QML being available but aren't part of the new QML UI
src/controllers/rendering/controllerrenderingengine.cpp
src/controllers/controllerenginethreadcontrol.cpp
src/controllers/controllerscreenpreview.cpp
)
endif()
if(QOPENGL)
target_sources(mixxx-lib PRIVATE
Expand Down Expand Up @@ -2176,7 +2183,14 @@ add_executable(mixxx-test
src/test/wwidgetstack_test.cpp
src/test/waveform_upgrade_test.cpp
src/util/moc_included_test.cpp
src/test/helpers/log_test.cpp
)
if (QML)
target_sources(mixxx-test PRIVATE
src/test/controller_mapping_file_handler_test.cpp
src/test/controllerrenderingengine_test.cpp
)
endif()
find_package(GTest CONFIG REQUIRED)
set_target_properties(mixxx-test PROPERTIES AUTOMOC ON)
target_link_libraries(mixxx-test PRIVATE mixxx-lib mixxx-gitinfostore GTest::gtest GTest::gmock)
Expand Down
22 changes: 22 additions & 0 deletions res/controllers/Dummy Device Screen.hid.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='utf-8'?>
<MixxxControllerPreset mixxxVersion="2.4.0" schemaVersion="1">
<info>
<name>Dummy Device (Screens)</name>
<author>A. Colombier</author>
<description>Dummy device screens</description>
<devices>
<product protocol="hid" vendor_id="0xdead" product_id="0xbeaf" />
</devices>
</info>
<controller id="DummyDevice">
<screens>
<screen identifier="main" width="480" height="360" targetFps="20" pixelType="RBGA" splashoff="500" />
<screen identifier="jog" width="128" height="128" targetFps="5" pixelType="RBGA" />
</screens>
<scriptfiles>
<file filename="DummyDeviceDefaultScreen.qml" />
</scriptfiles>
<qmllibraries>
</qmllibraries>
</controller>
</MixxxControllerPreset>
305 changes: 305 additions & 0 deletions res/controllers/DummyDeviceDefaultScreen.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
import QtQuick 2.15
import QtQuick.Window 2.3

import QtQuick.Controls 2.15
import QtQuick.Shapes 1.11
import QtQuick.Layouts 1.3
import QtQuick.Window 2.15

import Qt5Compat.GraphicalEffects

import Mixxx 1.0 as Mixxx
import Mixxx.Controls 1.0 as MixxxControls

import "." as Skin

Item {
id: root

required property string screenId
property color fontColor: Qt.rgba(242/255,242/255,242/255, 1)
property color smallBoxBorder: Qt.rgba(44/255,44/255,44/255, 1)

property string group: "[Channel1]"
property var deckPlayer: Mixxx.PlayerManager.getPlayer(root.group)

function init(controlerName, isDebug) {
console.log(`Screen ${root.screenId} has started`)
switch (root.screenId) {
case "jog":
loader.sourceComponent = jog
break;
default:
loader.sourceComponent = main
}
}

function shutdown() {
console.log(`Screen ${root.screenId} is stopping`)
loader.sourceComponent = splash
}

// function transformFrame(input: ArrayBuffer, timestamp: date) {
function transformFrame(input, timestamp) {
return new ArrayBuffer(0);
}

Mixxx.ControlProxy {
group: root.group
key: "track_loaded"

onValueChanged: (value) => {
deckPlayer = Mixxx.PlayerManager.getPlayer(root.group)
}
}

Timer {
id: channelchange

interval: 2000
repeat: true
running: true

onTriggered: {
root.group = root.group === "[Channel1]" ? "[Channel2]" : "[Channel1]"
deckPlayer = Mixxx.PlayerManager.getPlayer(root.group)
}
}

Component {
id: splash
Rectangle {
color: "black"
anchors.fill: parent
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: "../images/templates/logo_mixxx.png"
}
}
}

Component {
id: jog

Rectangle {
anchors.fill: parent
color: "black"

Image {
id: artwork
anchors.fill: parent
visible: deckPlayer.trackLocationUrl.toString().length !== 0

source: deckPlayer.coverArtUrl ?? "../images/templates/logo_mixxx.png"
height: 100
width: 100
fillMode: Image.PreserveAspectFit
}

Text {
visible: deckPlayer.trackLocationUrl.toString().length === 0

text: qsTr("No Track Loaded")
font.pixelSize: 12
font.family: "Noto Sans"
font.letterSpacing: -1
color: "white"
}
}
}

Component {
id: main

Rectangle {
id: debugValue
anchors.fill: parent
color: 'black'

antialiasing: true

ColumnLayout {
id: column
anchors.fill: parent
anchors.leftMargin: 0
anchors.rightMargin: 0
anchors.topMargin: 0
anchors.bottomMargin: 0
spacing: 6

RowLayout {
Layout.fillWidth: true
spacing: 0

Repeater {
id: debugColor

model: [
"black",
"white",
"red",
"green",
"blue",
Qt.rgba(0, 1, 1),
]

Rectangle {
required property var modelData

color: modelData
Layout.fillWidth: true
height: 80
}
}
}

RowLayout {
anchors.leftMargin: 6
anchors.rightMargin: 6
anchors.topMargin: 6
anchors.bottomMargin: 6

Layout.fillWidth: true
Layout.fillHeight: true
spacing: 6

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: qsTr("Group")
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: `${root.group}`
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}
}

RowLayout {
anchors.leftMargin: 6
anchors.rightMargin: 6
anchors.topMargin: 6
anchors.bottomMargin: 6

Layout.fillWidth: true
Layout.fillHeight: true
spacing: 6

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: qsTr("Widget")
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true

Skin.HotcueButton {
anchors.fill: parent

hotcueNumber: 1
group: root.group
}
}
}

Repeater {
model: [{
controllerKey: "beatloop_size",
title: "Beatloop Size"
}, {
controllerKey: "track_samples",
title: "Track sample"
}, {
controllerKey: "track_samplerate",
title: "Track sample rate"
}, {
controllerKey: "playposition",
title: "Play position"
}, {
controllerKey: "rate_ratio",
title: "Rate ratio"
}, {
controllerKey: "waveform_zoom",
title: "Waveform zoom"
}
]

RowLayout {
id: row
anchors.leftMargin: 6
anchors.rightMargin: 6
anchors.topMargin: 6
anchors.bottomMargin: 6
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 6
required property var modelData

Mixxx.ControlProxy {
id: mixxxValue
group: root.group
key: modelData.controllerKey
}

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: qsTr(modelData.title)
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: `${mixxxValue.value}`
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}
}
}
}
}
}
Loader {
id: loader
anchors.fill: parent
sourceComponent: splash
}
}
Loading

0 comments on commit 9b33757

Please sign in to comment.