Implement new way of handling Desktop Overlay width

This commit is contained in:
Vasily
2019-03-31 22:31:26 +02:00
committed by username223
parent 760d262a57
commit ab901e90fc
7 changed files with 23 additions and 46 deletions
+3
View File
@@ -72,6 +72,9 @@ overlay::DesktopOverlay::DesktopOverlay()
m_rightMovement m_rightMovement
= settings.value( strings::rightMovementSettingsName, defaultMovement ) = settings.value( strings::rightMovementSettingsName, defaultMovement )
.toDouble(); .toDouble();
m_upMovement
= settings.value( strings::upMovementSettingsName, defaultMovement )
.toDouble();
settings.endGroup(); settings.endGroup();
} }
+1
View File
@@ -24,6 +24,7 @@ namespace strings
constexpr auto defaultOverlayWidth = 4.0; constexpr auto defaultOverlayWidth = 4.0;
constexpr auto defaultMovement = 0.0; constexpr auto defaultMovement = 0.0;
constexpr auto defaultWidth = 1.0;
class DesktopOverlay : public QObject class DesktopOverlay : public QObject
{ {
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common" import "../../common"
GroupBox { GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true Layout.fillWidth: true
label: MyText { label: MyText {
@@ -18,24 +17,23 @@ GroupBox {
border.color: "#ffffff" border.color: "#ffffff"
radius: 8 radius: 8
} }
property real sliderStepSize: 1.0
property real sliderStartingValue: 1.0
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
Rectangle { LineSeparator {
color: "#ffffff"
height: 1
Layout.fillWidth: true
Layout.bottomMargin: 5
} }
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
MyPushButton2 { MyPushButton2 {
id: steamDesktopWidthMinusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
steamDesktopWidthSlider.value -= 1.0 steamDesktopWidthSlider.value -= sliderStepSize
} }
} }
@@ -44,24 +42,22 @@ GroupBox {
from: 0.1 from: 0.1
to: 32.0 to: 32.0
stepSize: 0.1 stepSize: 0.1
value: 1.0 value: sliderStartingValue
Layout.fillWidth: true Layout.fillWidth: true
onPositionChanged: { onPositionChanged: {
var val = this.from + ( this.position * (this.to - this.from)) //
steamDesktopWidthText.text = val.toFixed(1)
} }
onValueChanged: { onValueChanged: {
UtilitiesTabController.setSteamDesktopOverlayWidth(value, false) DesktopOverlay.width = this.value
steamDesktopWidthText.text = value.toFixed(1) steamDesktopWidthText.text = this.value.toFixed(2)
} }
} }
MyPushButton2 { MyPushButton2 {
id: steamDesktopWidthPlusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
steamDesktopWidthSlider.value += 1.0 steamDesktopWidthSlider.value += sliderStepSize
} }
} }
@@ -79,30 +75,13 @@ GroupBox {
val = 0.1 val = 0.1
} }
steamDesktopWidthSlider.value = val steamDesktopWidthSlider.value = val
UtilitiesTabController.setSteamDesktopOverlayWidth(val, false)
} }
text = UtilitiesTabController.steamDesktopOverlayWidth.toFixed(1)
} }
} }
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
steamDesktopGroupBox.visible = UtilitiesTabController.steamDesktopOverlayAvailable steamDesktopWidthSlider.value = DesktopOverlay.width
if (steamDesktopGroupBox.visible) {
steamDesktopWidthSlider.value = UtilitiesTabController.steamDesktopOverlayWidth
}
}
Connections {
target: UtilitiesTabController
onSteamDesktopOverlayAvailableChanged: {
steamDesktopGroupBox.visible = UtilitiesTabController.steamDesktopOverlayAvailable
if (steamDesktopGroupBox.visible) {
steamDesktopWidthSlider.value = UtilitiesTabController.steamDesktopOverlayWidth
}
}
onSteamDesktopOverlayWidthChanged: {
steamDesktopWidthSlider.value = UtilitiesTabController.steamDesktopOverlayWidth
}
} }
} }
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common" import "../../common"
GroupBox { GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true Layout.fillWidth: true
label: MyText { label: MyText {
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common" import "../../common"
GroupBox { GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true Layout.fillWidth: true
label: MyText { label: MyText {
@@ -30,16 +29,15 @@ GroupBox {
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
MyPushButton2 { MyPushButton2 {
id: steamDesktopWidthMinusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
steamDesktopWidthSlider.value -= sliderStepSize steamDesktopRightSlider.value -= sliderStepSize
} }
} }
MySlider { MySlider {
id: steamDesktopWidthSlider id: steamDesktopRightSlider
from: -rightLeftLimit from: -rightLeftLimit
to: rightLeftLimit to: rightLeftLimit
stepSize: sliderStepSize stepSize: sliderStepSize
@@ -47,34 +45,33 @@ GroupBox {
Layout.fillWidth: true Layout.fillWidth: true
onValueChanged: { onValueChanged: {
DesktopOverlay.rightMovement = this.value DesktopOverlay.rightMovement = this.value
steamDesktopWidthText.text = this.value.toFixed(2) steamDesktopRightText.text = this.value.toFixed(2)
} }
} }
MyPushButton2 { MyPushButton2 {
id: steamDesktopWidthPlusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
steamDesktopWidthSlider.value += sliderStepSize steamDesktopRightSlider.value += sliderStepSize
} }
} }
MyTextField { MyTextField {
id: steamDesktopWidthText id: steamDesktopRightText
text: "0.0" text: "0.0"
keyBoardUID: 611 keyBoardUID: 611
Layout.preferredWidth: 100 Layout.preferredWidth: 100
Layout.leftMargin: 10 Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
onAcceptableInputChanged: { onAcceptableInputChanged: {
steamDesktopWidthSlider.value = this.value steamDesktopRightSlider.value = this.value
} }
} }
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
steamDesktopWidthSlider.value = DesktopOverlay.rightMovement steamDesktopRightSlider.value = DesktopOverlay.rightMovement
} }
} }
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common" import "../../common"
GroupBox { GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true Layout.fillWidth: true
label: MyText { label: MyText {
@@ -4,7 +4,6 @@ import QtQuick.Layouts 1.3
import ovras.advsettings 1.0 import ovras.advsettings 1.0
import "media_keys" import "media_keys"
import "alarm_clock" import "alarm_clock"
import "desktop_size"
import "keyboard_utils" import "keyboard_utils"
import "../common" import "../common"