1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-08 03:52:42 +01:00

Fix issue #100 by replaceing custom popup with Qt Controls popup

This commit is contained in:
Elias Steurer 2020-08-09 12:46:51 +02:00
parent 750b0d1ef8
commit 4f8a4a2681
3 changed files with 39 additions and 129 deletions

View File

@ -116,10 +116,6 @@ ApplicationWindow {
function onRequestNavigation(nav) { function onRequestNavigation(nav) {
switchPage(nav) switchPage(nav)
} }
function onRequestToggleWallpaperConfiguration() {
monitors.state = monitors.state == "active" ? "inactive" : "active"
ScreenPlay.screenPlayManager.requestProjectSettingsAtMonitorIndex(0)
}
} }
Connections { Connections {
@ -315,19 +311,13 @@ ApplicationWindow {
left: parent.left left: parent.left
} }
onChangePage: { onChangePage: {
if (monitors.state === "active") { monitors.close()
monitors.state = "inactive"
}
switchPage(name) switchPage(name)
} }
} }
Monitors { Monitors {
id: monitors id: monitors
state: "inactive"
anchors.fill: pageLoader
z: 98
} }
} }

View File

@ -9,46 +9,42 @@ import ScreenPlay 1.0
import ScreenPlay.Enums.InstalledType 1.0 import ScreenPlay.Enums.InstalledType 1.0
import "../Common/" as SP import "../Common/" as SP
Item { Popup {
id: monitors id: monitors
state: "inactive" width: 1000
height: 500
dim: true
anchors.centerIn: Overlay.overlay
modal: true
focus: true focus: true
background: Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Material.background
}
property string activeMonitorName: "" property string activeMonitorName: ""
property int activeMonitorIndex property int activeMonitorIndex
onStateChanged: { Connections {
bgMouseArea.focus = monitors.state == "active" ? true : false target: ScreenPlay.util
if (monitors.state === "active") { function onRequestToggleWallpaperConfiguration() {
ScreenPlay.screenPlayManager.requestProjectSettingsAtMonitorIndex(0) monitors.open()
} }
} }
Rectangle { onOpened: {
id: background ScreenPlay.screenPlayManager.requestProjectSettingsAtMonitorIndex(
color: "#cc000000" 0)
anchors.fill: parent
MouseArea {
id: bgMouseArea
anchors.fill: parent
onClicked: monitors.state = "inactive"
}
} }
Rectangle { Item {
id: monitorsSettingsWrapper id: monitorsSettingsWrapper
color: Material.theme === Material.Light ? "white" : Material.background
radius: 3
z: 98
width: 1000
height: 500
clip: true clip: true
anchors { anchors {
top: parent.top fill: parent
topMargin: 50 margins: 10
horizontalCenter: parent.horizontalCenter
margins: 50
} }
Item { Item {
@ -92,11 +88,13 @@ Item {
availableHeight: 150 availableHeight: 150
onRequestProjectSettings: { onRequestProjectSettings: {
if (installedType === InstalledType.VideoWallpaper) { if (installedType === InstalledType.VideoWallpaper) {
videoControlWrapper.state = "visible" videoControlWrapper.state = "visible"
customPropertiesGridView.visible = false customPropertiesGridView.visible = false
print(appID) print(appID)
const wallpaper = ScreenPlay.screenPlayManager.getWallpaperByAppID(appID) const wallpaper = ScreenPlay.screenPlayManager.getWallpaperByAppID(
appID)
print("volume", wallpaper.volume) print("volume", wallpaper.volume)
} else { } else {
videoControlWrapper.state = "hidden" videoControlWrapper.state = "hidden"
@ -219,101 +217,23 @@ Item {
} }
} }
} }
MouseArea {
ToolButton{
anchors { anchors {
top: parent.top top: parent.top
right: parent.right right: parent.right
margins: 5
} }
width: 32 width: 32
height: width height: width
cursorShape: Qt.PointingHandCursor icon.width: 16
onClicked: monitors.state = "inactive" icon.height:16
icon.source: "qrc:/assets/icons/font-awsome/close.svg"
icon.color: "gray"
onClicked: monitors.close()
Image {
id: imgClose
source: "qrc:/assets/icons/font-awsome/close.svg"
width: 16
height: 16
anchors.centerIn: parent
sourceSize: Qt.size(width, width)
}
ColorOverlay {
id: iconColorOverlay
anchors.fill: imgClose
source: imgClose
color: "gray"
}
} }
} }
states: [
State {
name: "active"
PropertyChanges {
target: monitors
opacity: 1
enabled: true
}
PropertyChanges {
target: background
opacity: 1
}
PropertyChanges {
target: monitorsSettingsWrapper
anchors.topMargin: 50
}
},
State {
name: "inactive"
PropertyChanges {
target: monitors
opacity: 0
enabled: false
}
PropertyChanges {
target: background
opacity: 0
}
PropertyChanges {
target: monitorsSettingsWrapper
anchors.topMargin: 150
}
}
]
transitions: [
Transition {
from: "active"
to: "inactive"
reversible: true
PropertyAnimation {
target: background
property: "opacity"
duration: 200
easing.type: Easing.OutQuart
}
PropertyAnimation {
target: monitorsSettingsWrapper
property: "anchors.topMargin"
duration: 200
easing.type: Easing.OutQuad
}
NumberAnimation {
target: monitors
property: "opacity"
duration: 200
easing.type: Easing.OutQuad
}
}
]
} }
/*##^## /*##^##

View File

@ -92,6 +92,7 @@ Item {
id: root id: root
anchors.fill: parent anchors.fill: parent
property bool value property bool value
signal save(var value)
CheckBox { CheckBox {
id: checkbox id: checkbox
@ -104,7 +105,7 @@ Item {
onCheckedChanged: { onCheckedChanged: {
let obj = { let obj = {
"value": checkbox.checked, "value": checkbox.checked,
"type": "checkBox", "type": "checkBox"
} }
root.save(obj) root.save(obj)
@ -156,10 +157,9 @@ Item {
rctPreviewColor.color = colorDialog.color rctPreviewColor.color = colorDialog.color
let tmpColor = "'" + colorDialog.color.toString() + "'" let tmpColor = "'" + colorDialog.color.toString() + "'"
let obj = { let obj = {
"value": colorDialog.color, "value": colorDialog.color,
"type": "color", "type": "color"
} }
root.save(obj) root.save(obj)
@ -180,7 +180,7 @@ Item {
property int from property int from
property int to property int to
property int value property int value
property int stepSize property int stepSize: 1
signal save(var value) signal save(var value)
@ -201,7 +201,7 @@ Item {
} }
onValueChanged: { onValueChanged: {
var value = Math.round(slider.value * 100) / 100 const value = Math.trunc(slider.value * 100) / 100
txtSliderValue.text = value txtSliderValue.text = value
let obj = { let obj = {