Skip to content

Commit

Permalink
Extract LabeledSlider
Browse files Browse the repository at this point in the history
  • Loading branch information
zhulik committed Jul 2, 2023
1 parent 9b89bb5 commit 19fef20
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 59 deletions.
60 changes: 1 addition & 59 deletions resources/qml/debug/ControllersTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,67 +29,9 @@ Rectangle {
ColumnLayout {
Layout.fillHeight: parent

RowLayout {
Components.VibrationSpoiler {
Layout.fillWidth: parent

ColumnLayout {
Layout.fillWidth: parent

RowLayout {
Slider {
id: usDurationMicroSecSlider
Layout.fillWidth: parent

from: 1
to: 65535
value: 2900
stepSize: 10
}

Label {
text: usDurationMicroSecSlider.value
}
}

RowLayout {
Slider {
id: usOffMicroSecSlider

Layout.fillWidth: parent
from: 1
to: 65535
stepSize: 10
value: 1200
}

Label {
text: usOffMicroSecSlider.value
}
}

RowLayout {
Slider {
id: unRepeatSlider

Layout.fillWidth: parent
from: 1
to: 100
value: 4
}

Label {
text: unRepeatSlider.value
}
}
}

MDI.Button {
iconName: "vibrate"

onClicked: {
steam_input.lastController.triggerRepeatedHapticPulse(usDurationMicroSecSlider.value, usOffMicroSecSlider.value, unRepeatSlider.value)
}
}
}

TabView {
Expand Down
21 changes: 21 additions & 0 deletions resources/qml/debug/ControllersTabComponents/LabeledSlider.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

RowLayout {
id: root

property alias from: slider.from
property alias to: slider.to
property alias value: slider.value
property alias stepSize: slider.stepSize

Slider {
id: slider
Layout.fillWidth: parent
}

Label {
text: slider.value
}
}
51 changes: 51 additions & 0 deletions resources/qml/debug/ControllersTabComponents/VibrationSpoiler.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

import "../../../../resources/qml/MDI" as MDI

RowLayout {
Layout.fillWidth: parent

ColumnLayout {
Layout.fillWidth: parent

LabeledSlider {
id: usDurationMicroSecSlider
Layout.fillWidth: parent

from: 1
to: 65535
value: 2900
stepSize: 10
}

LabeledSlider {
id: usOffMicroSecSlider

Layout.fillWidth: parent
from: 1
to: 65535
stepSize: 10
value: 1200
}


LabeledSlider {
id: unRepeatSlider

Layout.fillWidth: parent
from: 1
to: 100
value: 4
}
}

MDI.Button {
iconName: "vibrate"

onClicked: {
steam_input.lastController.triggerRepeatedHapticPulse(usDurationMicroSecSlider.value, usOffMicroSecSlider.value, unRepeatSlider.value)
}
}
}

0 comments on commit 19fef20

Please sign in to comment.