Fix incorrect behavior in QML
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include "overlay_utils.h"
|
#include "overlay_utils.h"
|
||||||
|
#include "../overlaycontroller.h"
|
||||||
|
|
||||||
namespace overlay
|
namespace overlay
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,10 @@ void setDesktopOverlayWidth( double width )
|
|||||||
|
|
||||||
void setSettingsToValue( const std::string setting, const double value )
|
void setSettingsToValue( const std::string setting, const double value )
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings( QSettings::Format::IniFormat,
|
||||||
|
QSettings::Scope::UserScope,
|
||||||
|
application_strings::applicationOrganizationName,
|
||||||
|
application_strings::applicationName );
|
||||||
settings.beginGroup( strings::settingsGroupName );
|
settings.beginGroup( strings::settingsGroupName );
|
||||||
settings.setValue( setting.c_str(), value );
|
settings.setValue( setting.c_str(), value );
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@@ -62,7 +66,12 @@ void setSettingsToValue( const std::string setting, const double value )
|
|||||||
|
|
||||||
overlay::DesktopOverlay::DesktopOverlay()
|
overlay::DesktopOverlay::DesktopOverlay()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings( QSettings::Format::IniFormat,
|
||||||
|
QSettings::Scope::UserScope,
|
||||||
|
application_strings::applicationOrganizationName,
|
||||||
|
application_strings::applicationName );
|
||||||
|
|
||||||
|
LOG( INFO ) << settings.fileName();
|
||||||
settings.beginGroup( strings::settingsGroupName );
|
settings.beginGroup( strings::settingsGroupName );
|
||||||
m_width = settings.value( strings::widthSettingsName, defaultOverlayWidth )
|
m_width = settings.value( strings::widthSettingsName, defaultOverlayWidth )
|
||||||
.toDouble();
|
.toDouble();
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
import ovras.advsettings 1.0
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
// Public properties
|
||||||
|
// Overload
|
||||||
|
property alias headerMessage: headerText.text
|
||||||
|
property alias sliderText: steamDesktopForwardText.text
|
||||||
|
property alias sliderValue: steamDesktopForwardSlider.value
|
||||||
|
property alias lowerLimit: steamDesktopForwardSlider.from
|
||||||
|
property alias upperLimit: steamDesktopForwardSlider.to
|
||||||
|
|
||||||
|
|
||||||
|
function onValueChanged(value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function onComponentComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Private properties
|
||||||
|
id: sliderBox
|
||||||
|
Layout.fillWidth: true
|
||||||
|
label: MyText {
|
||||||
|
id: headerText
|
||||||
|
leftPadding: 10
|
||||||
|
text: "MISSING HEADER TEXT"
|
||||||
|
bottomPadding: -10
|
||||||
|
}
|
||||||
|
background: Rectangle {
|
||||||
|
color: "transparent"
|
||||||
|
border.color: "#ffffff"
|
||||||
|
radius: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
property real sliderStepSize: 0.10
|
||||||
|
readonly property real rightLeftLimit: 4.0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
LineSeparator {
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
RowLayout {
|
||||||
|
MyPushButton2 {
|
||||||
|
Layout.preferredWidth: 40
|
||||||
|
text: "-"
|
||||||
|
onClicked: {
|
||||||
|
steamDesktopForwardSlider.value -= sliderStepSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MySlider {
|
||||||
|
id: steamDesktopForwardSlider
|
||||||
|
from: -rightLeftLimit
|
||||||
|
to: rightLeftLimit
|
||||||
|
stepSize: sliderStepSize
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onValueChanged: {
|
||||||
|
sliderBox.onValueChanged(this.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyPushButton2 {
|
||||||
|
Layout.preferredWidth: 40
|
||||||
|
text: "+"
|
||||||
|
onClicked: {
|
||||||
|
steamDesktopForwardSlider.value += sliderStepSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyTextField {
|
||||||
|
id: steamDesktopForwardText
|
||||||
|
text: "0.0"
|
||||||
|
keyBoardUID: 611
|
||||||
|
Layout.preferredWidth: 100
|
||||||
|
Layout.leftMargin: 10
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
onAcceptableInputChanged: {
|
||||||
|
steamDesktopForwardSlider.value = this.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
sliderBox.onComponentComplete()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,84 +4,19 @@ import QtQuick.Layouts 1.3
|
|||||||
import ovras.advsettings 1.0
|
import ovras.advsettings 1.0
|
||||||
import "../../common"
|
import "../../common"
|
||||||
|
|
||||||
GroupBox {
|
FullWidthSliderBox {
|
||||||
Layout.fillWidth: true
|
headerMessage: "Overlay Width"
|
||||||
|
|
||||||
label: MyText {
|
lowerLimit: 0.0
|
||||||
leftPadding: 10
|
upperLimit: 32.0
|
||||||
text: "Steam Desktop Overlay Width"
|
sliderStepSize: 0.5
|
||||||
bottomPadding: -10
|
|
||||||
|
function onValueChanged(value) {
|
||||||
|
DesktopOverlay.width = value
|
||||||
|
sliderText = value.toFixed(2)
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
function onComponentComplete() {
|
||||||
color: "transparent"
|
sliderValue = DesktopOverlay.width
|
||||||
border.color: "#ffffff"
|
|
||||||
radius: 8
|
|
||||||
}
|
|
||||||
|
|
||||||
property real sliderStepSize: 1.0
|
|
||||||
property real sliderStartingValue: 1.0
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
LineSeparator {
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
RowLayout {
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "-"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopWidthSlider.value -= sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MySlider {
|
|
||||||
id: steamDesktopWidthSlider
|
|
||||||
from: 0.1
|
|
||||||
to: 32.0
|
|
||||||
stepSize: 0.1
|
|
||||||
value: sliderStartingValue
|
|
||||||
Layout.fillWidth: true
|
|
||||||
onPositionChanged: {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
onValueChanged: {
|
|
||||||
DesktopOverlay.width = this.value
|
|
||||||
steamDesktopWidthText.text = this.value.toFixed(2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "+"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopWidthSlider.value += sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyTextField {
|
|
||||||
id: steamDesktopWidthText
|
|
||||||
text: "0.0"
|
|
||||||
keyBoardUID: 611
|
|
||||||
Layout.preferredWidth: 100
|
|
||||||
Layout.leftMargin: 10
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
function onInputEvent(input) {
|
|
||||||
var val = parseFloat(input)
|
|
||||||
if (!isNaN(val)) {
|
|
||||||
if (val < 0.1) {
|
|
||||||
val = 0.1
|
|
||||||
}
|
|
||||||
steamDesktopWidthSlider.value = val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
steamDesktopWidthSlider.value = DesktopOverlay.width
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-67
@@ -4,74 +4,18 @@ import QtQuick.Layouts 1.3
|
|||||||
import ovras.advsettings 1.0
|
import ovras.advsettings 1.0
|
||||||
import "../../common"
|
import "../../common"
|
||||||
|
|
||||||
GroupBox {
|
FullWidthSliderBox {
|
||||||
Layout.fillWidth: true
|
headerMessage: "Forwards/Backwards Translation"
|
||||||
|
|
||||||
label: MyText {
|
lowerLimit: -4.0
|
||||||
leftPadding: 10
|
upperLimit: 4.0
|
||||||
text: "Backwards/Forwards Translation"
|
sliderStepSize: 0.10
|
||||||
bottomPadding: -10
|
|
||||||
|
function onValueChanged(value) {
|
||||||
|
DesktopOverlay.forwardsMovement = value
|
||||||
|
sliderText = value.toFixed(2)
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
function onComponentComplete() {
|
||||||
color: "transparent"
|
sliderValue = DesktopOverlay.forwardsMovement
|
||||||
border.color: "#ffffff"
|
|
||||||
radius: 8
|
|
||||||
}
|
|
||||||
property real sliderStepSize: 0.10
|
|
||||||
property real rightLeftLimit: 4.0
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
LineSeparator {
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
RowLayout {
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "-"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopForwardSlider.value -= sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MySlider {
|
|
||||||
id: steamDesktopForwardSlider
|
|
||||||
from: -rightLeftLimit
|
|
||||||
to: rightLeftLimit
|
|
||||||
stepSize: sliderStepSize
|
|
||||||
value: 0.0
|
|
||||||
Layout.fillWidth: true
|
|
||||||
onValueChanged: {
|
|
||||||
DesktopOverlay.forwardsMovement = this.value
|
|
||||||
steamDesktopForwardText.text = this.value.toFixed(2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "+"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopForwardSlider.value += sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyTextField {
|
|
||||||
id: steamDesktopForwardText
|
|
||||||
text: "0.0"
|
|
||||||
keyBoardUID: 611
|
|
||||||
Layout.preferredWidth: 100
|
|
||||||
Layout.leftMargin: 10
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
onAcceptableInputChanged: {
|
|
||||||
steamDesktopForwardSlider.value = this.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
steamDesktopForwardSlider.value = DesktopOverlay.forwardsMovement
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-67
@@ -4,74 +4,18 @@ import QtQuick.Layouts 1.3
|
|||||||
import ovras.advsettings 1.0
|
import ovras.advsettings 1.0
|
||||||
import "../../common"
|
import "../../common"
|
||||||
|
|
||||||
GroupBox {
|
FullWidthSliderBox {
|
||||||
Layout.fillWidth: true
|
headerMessage: "Left/Right Translation"
|
||||||
|
|
||||||
label: MyText {
|
lowerLimit: -4.0
|
||||||
leftPadding: 10
|
upperLimit: 4.0
|
||||||
text: "Left/Right Translation"
|
sliderStepSize: 0.10
|
||||||
bottomPadding: -10
|
|
||||||
|
function onValueChanged(value) {
|
||||||
|
DesktopOverlay.rightMovement = value
|
||||||
|
sliderText = value.toFixed(2)
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
function onComponentComplete() {
|
||||||
color: "transparent"
|
sliderValue = DesktopOverlay.rightMovement
|
||||||
border.color: "#ffffff"
|
|
||||||
radius: 8
|
|
||||||
}
|
|
||||||
property real sliderStepSize: 0.10
|
|
||||||
property real rightLeftLimit: 4.0
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
LineSeparator {
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
RowLayout {
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "-"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopRightSlider.value -= sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MySlider {
|
|
||||||
id: steamDesktopRightSlider
|
|
||||||
from: -rightLeftLimit
|
|
||||||
to: rightLeftLimit
|
|
||||||
stepSize: sliderStepSize
|
|
||||||
value: 0.0
|
|
||||||
Layout.fillWidth: true
|
|
||||||
onValueChanged: {
|
|
||||||
DesktopOverlay.rightMovement = this.value
|
|
||||||
steamDesktopRightText.text = this.value.toFixed(2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "+"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopRightSlider.value += sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyTextField {
|
|
||||||
id: steamDesktopRightText
|
|
||||||
text: "0.0"
|
|
||||||
keyBoardUID: 611
|
|
||||||
Layout.preferredWidth: 100
|
|
||||||
Layout.leftMargin: 10
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
onAcceptableInputChanged: {
|
|
||||||
steamDesktopRightSlider.value = this.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
steamDesktopRightSlider.value = DesktopOverlay.rightMovement
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-67
@@ -4,74 +4,18 @@ import QtQuick.Layouts 1.3
|
|||||||
import ovras.advsettings 1.0
|
import ovras.advsettings 1.0
|
||||||
import "../../common"
|
import "../../common"
|
||||||
|
|
||||||
GroupBox {
|
FullWidthSliderBox {
|
||||||
Layout.fillWidth: true
|
headerMessage: "Up/Down Translation"
|
||||||
|
|
||||||
label: MyText {
|
lowerLimit: -4.0
|
||||||
leftPadding: 10
|
upperLimit: 4.0
|
||||||
text: "Up/Down Translation"
|
sliderStepSize: 0.10
|
||||||
bottomPadding: -10
|
|
||||||
|
function onValueChanged(value) {
|
||||||
|
DesktopOverlay.height = value
|
||||||
|
sliderText = value.toFixed(2)
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
function onComponentComplete() {
|
||||||
color: "transparent"
|
sliderValue = DesktopOverlay.height
|
||||||
border.color: "#ffffff"
|
|
||||||
radius: 8
|
|
||||||
}
|
|
||||||
property real sliderStepSize: 0.10
|
|
||||||
property real rightLeftLimit: 4.0
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
LineSeparator {
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
RowLayout {
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "-"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopUpSlider.value -= sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MySlider {
|
|
||||||
id: steamDesktopUpSlider
|
|
||||||
from: -rightLeftLimit
|
|
||||||
to: rightLeftLimit
|
|
||||||
stepSize: sliderStepSize
|
|
||||||
value: 0.0
|
|
||||||
Layout.fillWidth: true
|
|
||||||
onValueChanged: {
|
|
||||||
DesktopOverlay.height = this.value
|
|
||||||
steamDesktopUpText.text = this.value.toFixed(2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPushButton2 {
|
|
||||||
Layout.preferredWidth: 40
|
|
||||||
text: "+"
|
|
||||||
onClicked: {
|
|
||||||
steamDesktopUpSlider.value += sliderStepSize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyTextField {
|
|
||||||
id: steamDesktopUpText
|
|
||||||
text: "0.0"
|
|
||||||
keyBoardUID: 611
|
|
||||||
Layout.preferredWidth: 100
|
|
||||||
Layout.leftMargin: 10
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
onAcceptableInputChanged: {
|
|
||||||
steamDesktopUpSlider.value = this.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
steamDesktopUpSlider.value = DesktopOverlay.height
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user