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
= settings.value( strings::rightMovementSettingsName, defaultMovement )
.toDouble();
m_upMovement
= settings.value( strings::upMovementSettingsName, defaultMovement )
.toDouble();
settings.endGroup();
}
+1
View File
@@ -24,6 +24,7 @@ namespace strings
constexpr auto defaultOverlayWidth = 4.0;
constexpr auto defaultMovement = 0.0;
constexpr auto defaultWidth = 1.0;
class DesktopOverlay : public QObject
{
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common"
GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true
label: MyText {
@@ -18,24 +17,23 @@ GroupBox {
border.color: "#ffffff"
radius: 8
}
property real sliderStepSize: 1.0
property real sliderStartingValue: 1.0
ColumnLayout {
anchors.fill: parent
Rectangle {
color: "#ffffff"
height: 1
Layout.fillWidth: true
Layout.bottomMargin: 5
LineSeparator {
}
ColumnLayout {
RowLayout {
MyPushButton2 {
id: steamDesktopWidthMinusButton
Layout.preferredWidth: 40
text: "-"
onClicked: {
steamDesktopWidthSlider.value -= 1.0
steamDesktopWidthSlider.value -= sliderStepSize
}
}
@@ -44,24 +42,22 @@ GroupBox {
from: 0.1
to: 32.0
stepSize: 0.1
value: 1.0
value: sliderStartingValue
Layout.fillWidth: true
onPositionChanged: {
var val = this.from + ( this.position * (this.to - this.from))
steamDesktopWidthText.text = val.toFixed(1)
//
}
onValueChanged: {
UtilitiesTabController.setSteamDesktopOverlayWidth(value, false)
steamDesktopWidthText.text = value.toFixed(1)
DesktopOverlay.width = this.value
steamDesktopWidthText.text = this.value.toFixed(2)
}
}
MyPushButton2 {
id: steamDesktopWidthPlusButton
Layout.preferredWidth: 40
text: "+"
onClicked: {
steamDesktopWidthSlider.value += 1.0
steamDesktopWidthSlider.value += sliderStepSize
}
}
@@ -79,30 +75,13 @@ GroupBox {
val = 0.1
}
steamDesktopWidthSlider.value = val
UtilitiesTabController.setSteamDesktopOverlayWidth(val, false)
}
text = UtilitiesTabController.steamDesktopOverlayWidth.toFixed(1)
}
}
}
}
}
Component.onCompleted: {
steamDesktopGroupBox.visible = UtilitiesTabController.steamDesktopOverlayAvailable
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
}
steamDesktopWidthSlider.value = DesktopOverlay.width
}
}
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common"
GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true
label: MyText {
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common"
GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true
label: MyText {
@@ -30,16 +29,15 @@ GroupBox {
ColumnLayout {
RowLayout {
MyPushButton2 {
id: steamDesktopWidthMinusButton
Layout.preferredWidth: 40
text: "-"
onClicked: {
steamDesktopWidthSlider.value -= sliderStepSize
steamDesktopRightSlider.value -= sliderStepSize
}
}
MySlider {
id: steamDesktopWidthSlider
id: steamDesktopRightSlider
from: -rightLeftLimit
to: rightLeftLimit
stepSize: sliderStepSize
@@ -47,34 +45,33 @@ GroupBox {
Layout.fillWidth: true
onValueChanged: {
DesktopOverlay.rightMovement = this.value
steamDesktopWidthText.text = this.value.toFixed(2)
steamDesktopRightText.text = this.value.toFixed(2)
}
}
MyPushButton2 {
id: steamDesktopWidthPlusButton
Layout.preferredWidth: 40
text: "+"
onClicked: {
steamDesktopWidthSlider.value += sliderStepSize
steamDesktopRightSlider.value += sliderStepSize
}
}
MyTextField {
id: steamDesktopWidthText
id: steamDesktopRightText
text: "0.0"
keyBoardUID: 611
Layout.preferredWidth: 100
Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter
onAcceptableInputChanged: {
steamDesktopWidthSlider.value = this.value
steamDesktopRightSlider.value = this.value
}
}
}
}
}
Component.onCompleted: {
steamDesktopWidthSlider.value = DesktopOverlay.rightMovement
steamDesktopRightSlider.value = DesktopOverlay.rightMovement
}
}
@@ -5,7 +5,6 @@ import ovras.advsettings 1.0
import "../../common"
GroupBox {
id: steamDesktopGroupBox
Layout.fillWidth: true
label: MyText {
@@ -4,7 +4,6 @@ import QtQuick.Layouts 1.3
import ovras.advsettings 1.0
import "media_keys"
import "alarm_clock"
import "desktop_size"
import "keyboard_utils"
import "../common"