get/set implemented
This commit is contained in:
@@ -33,51 +33,62 @@ GroupBox {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
MyToggleButton {
|
MyToggleButton {
|
||||||
id: turnBindLeft
|
id: brightnessToggle
|
||||||
text: "Enable Left Hand"
|
text: "Toggle Brightness Adjustment"
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
MoveCenterTabController.turnBindLeft = this.checked
|
MoveCenterTabController.turnBindLeft = this.checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyToggleButton {
|
|
||||||
id: turnBindRight
|
|
||||||
text: "Enable Right Hand"
|
|
||||||
onCheckedChanged: {
|
|
||||||
MoveCenterTabController.turnBindRight = this.checked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
MyText {
|
MyText {
|
||||||
text: "Turn Comfort Mode:"
|
text: "Brightness:"
|
||||||
horizontalAlignment: Text.AlignRight
|
horizontalAlignment: Text.AlignRight
|
||||||
Layout.rightMargin: 10
|
Layout.rightMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
MySlider {
|
MySlider {
|
||||||
id: turnComfortSlider
|
id: brightnessSlider
|
||||||
from: 0
|
from: 0.00
|
||||||
to: 10
|
to: 1.0
|
||||||
stepSize: 1
|
stepSize: 0.01
|
||||||
value: 0
|
value: 1.0.
|
||||||
Layout.preferredWidth: 200
|
var val = (this.position * 100)/2 + 50
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
chaperoneVisibilityText.text = Math.round(val) + "%"
|
||||||
|
}
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
turnComfortText.text = turnComfortSlider.value
|
//TODO change value
|
||||||
MoveCenterTabController.turnComfortFactor = turnComfortSlider.value
|
ChaperoneTabController.setBoundsVisibility(value.toFixed(2), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyText {
|
MyTextField {
|
||||||
id: turnComfortText
|
id: chaperoneVisibilityText
|
||||||
text: "0"
|
text: "100.00"
|
||||||
horizontalAlignment: Text.AlignRight
|
keyBoardUID: 301
|
||||||
Layout.preferredWidth: 30
|
Layout.preferredWidth: 100
|
||||||
Layout.rightMargin: 10
|
Layout.leftMargin: 10
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
function onInputEvent(input) {
|
||||||
|
var val = parseFloat(input)
|
||||||
|
if (!isNaN(val)) {
|
||||||
|
if (val < 50.0) {
|
||||||
|
val = 50.0
|
||||||
|
} else if (val > 100.0) {
|
||||||
|
val = 100.0
|
||||||
|
}
|
||||||
|
var v = (val/100).toFixed(2)
|
||||||
|
if (v <= chaperoneVisibilitySlider.to) {
|
||||||
|
chaperoneVisibilitySlider.value = v
|
||||||
|
} else {
|
||||||
|
ChaperoneTabController.setBoundsVisibility(v, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text = Math.round(ChaperoneTabController.boundsVisibility * 100) + "%"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,4 +85,42 @@ namespace advsettings
|
|||||||
void VideoTabController::saveVideoConfig() {
|
void VideoTabController::saveVideoConfig() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float VideoTabController::brightnessValue() const
|
||||||
|
{
|
||||||
|
return m_brightnessValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoTabController::brightnessEnabled() const
|
||||||
|
{
|
||||||
|
return m_brightnessEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoTabController::setBrightnessEnabled(bool value, bool notify)
|
||||||
|
{
|
||||||
|
//TODO mutex?
|
||||||
|
//std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
|
||||||
|
if (value != m_brightnessEnabled)
|
||||||
|
{
|
||||||
|
m_brightnessEnabled = value;
|
||||||
|
if (notify)
|
||||||
|
{
|
||||||
|
emit brightnessEnabledChanged(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoTabController::setBrightnessvalue(float value, bool notify)
|
||||||
|
{
|
||||||
|
//TODO mutex?
|
||||||
|
//std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
|
||||||
|
if (value != m_brightnessValue)
|
||||||
|
{
|
||||||
|
m_brightnessValue = value;
|
||||||
|
if (notify)
|
||||||
|
{
|
||||||
|
emit brightnessValueChanged(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,40 +2,55 @@
|
|||||||
|
|
||||||
namespace advsettings {
|
namespace advsettings {
|
||||||
|
|
||||||
Q_OBJECT
|
class ChaperoneTabController : public QObject
|
||||||
Q_PROPERTY(int playbackDeviceIndex READ playbackDeviceIndex WRITE
|
|
||||||
setPlaybackDeviceIndex NOTIFY playbackDeviceIndexChanged)
|
|
||||||
Q_PROPERTY(int mirrorDeviceIndex READ mirrorDeviceIndex WRITE
|
|
||||||
setMirrorDeviceIndex NOTIFY mirrorDeviceIndexChanged)
|
|
||||||
|
|
||||||
private:
|
|
||||||
//TODO
|
|
||||||
constexpr auto notificationBrightnessFilename
|
|
||||||
= "todo";
|
|
||||||
vr::VROverlayHandle_t m_brightnessNotificationOverlayHandle
|
|
||||||
= vr::k_ulOverlayHandleInvalid;
|
|
||||||
float m_brightnessValue = 1.0;
|
|
||||||
bool m_brightnessEnabled = false;
|
|
||||||
|
|
||||||
void reloadVideoConfig();
|
|
||||||
void saveVideoConfig();
|
|
||||||
|
|
||||||
|
|
||||||
QString getSettingsName() override
|
|
||||||
{
|
{
|
||||||
return "videoSettings";
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool brightnessEnabled READ brightnessEnabled WRITE
|
||||||
|
setBrightnessEnabled NOTIFY brightnessEnabledChanged)
|
||||||
|
Q_PROPERTY(float brightnessValue READ brightnessValue WRITE
|
||||||
|
setBrightnessValue NOTIFY brightnessValueChanged)
|
||||||
|
|
||||||
|
private:
|
||||||
|
//TODO
|
||||||
|
constexpr auto notificationBrightnessFilename
|
||||||
|
= "todo";
|
||||||
|
vr::VROverlayHandle_t m_brightnessNotificationOverlayHandle
|
||||||
|
= vr::k_ulOverlayHandleInvalid;
|
||||||
|
float m_brightnessValue = 1.0;
|
||||||
|
bool m_brightnessEnabled = false;
|
||||||
|
|
||||||
|
void reloadVideoConfig();
|
||||||
|
void saveVideoConfig();
|
||||||
|
|
||||||
|
|
||||||
|
QString getSettingsName() override
|
||||||
|
{
|
||||||
|
return "videoSettings";
|
||||||
|
}
|
||||||
|
|
||||||
|
vr::VROverlayHandle_t getBrightnessOverlayHandle()
|
||||||
|
{
|
||||||
|
return m_brightnessNotificationOverlayHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
float brightnessValue() const;
|
||||||
|
bool brightnessEnabled() const;
|
||||||
|
|
||||||
|
void initStage1();
|
||||||
|
//TODO ?? on args
|
||||||
|
void initStage2(OverlayController* var_parent, QQuickWindow* var_widget);
|
||||||
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setBrightnessEnabled(bool value, bool notify = true);
|
||||||
|
void setBrightnessValue(float value, bool notify = true);
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void brightnessEnabledChanged(bool value);
|
||||||
|
void brightnessValueChanged(float value);
|
||||||
}
|
}
|
||||||
|
|
||||||
vr::VROverlayHandle_t getBrightnessOverlayHandle()
|
|
||||||
{
|
|
||||||
return m_brightnessNotificationOverlayHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
void initStage1();
|
|
||||||
//TODO ?? on args
|
|
||||||
void initStage2(OverlayController* var_parent, QQuickWindow* var_widget);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user