107 lines
2.6 KiB
QML
107 lines
2.6 KiB
QML
// GoalDialog.qml — Dialog for setting a session goal
|
|
import QtQuick 2.15
|
|
import QtQuick.Controls 2.15
|
|
import QtQuick.Layouts 1.15
|
|
|
|
Dialog {
|
|
id: root
|
|
title: "Set Goal"
|
|
width: 500
|
|
height: 300
|
|
modal: false
|
|
x: (parent ? (parent.width - width) / 2 : 0)
|
|
y: (parent ? (parent.height - height) / 2 : 0)
|
|
|
|
property string sessionId: ""
|
|
property string sessionName: ""
|
|
|
|
background: Item {
|
|
Rectangle {
|
|
x: 4
|
|
y: 6
|
|
width: parent.width
|
|
height: parent.height
|
|
color: Qt.rgba(0, 0, 0, 0.28)
|
|
radius: 4
|
|
}
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: theme.windowColor
|
|
border.color: theme.dialogOutlineColor
|
|
border.width: 3
|
|
radius: 4
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
anchors.margins: 3
|
|
color: "transparent"
|
|
border.color: theme.lightColor
|
|
border.width: 1
|
|
radius: 3
|
|
}
|
|
}
|
|
}
|
|
|
|
header: Rectangle {
|
|
implicitHeight: 36
|
|
color: theme.buttonColor
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: root.title
|
|
color: theme.buttonTextColor
|
|
}
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
cursorShape: Qt.SizeAllCursor
|
|
property point pressPosition
|
|
onPressed: pressPosition = Qt.point(mouse.x, mouse.y)
|
|
onPositionChanged: if (pressed) {
|
|
root.x += mouse.x - pressPosition.x
|
|
root.y += mouse.y - pressPosition.y
|
|
}
|
|
}
|
|
}
|
|
|
|
contentItem: ColumnLayout {
|
|
spacing: 8
|
|
Layout.margins: 16
|
|
|
|
ScrollView {
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
|
|
TextArea {
|
|
id: goalText
|
|
placeholderText: "Describe what you want to accomplish..."
|
|
wrapMode: TextEdit.Wrap
|
|
}
|
|
}
|
|
}
|
|
|
|
footer: RowLayout {
|
|
Layout.fillWidth: true
|
|
Item { Layout.fillWidth: true }
|
|
Button {
|
|
text: "OK"
|
|
onClicked: {
|
|
var text = goalText.text.trim()
|
|
if (text !== "" && root.sessionName !== "") {
|
|
ollie.setGoal(root.sessionName, text)
|
|
}
|
|
root.close()
|
|
}
|
|
}
|
|
Button {
|
|
text: "Cancel"
|
|
onClicked: root.close()
|
|
}
|
|
}
|
|
|
|
focus: false
|
|
|
|
onOpened: {
|
|
goalText.text = ""
|
|
goalText.forceActiveFocus()
|
|
}
|
|
}
|