refactor: separate launcher into multiple files
This commit is contained in:
parent
7ee7dc59a6
commit
fc87280dcf
3 changed files with 134 additions and 114 deletions
64
modules/launcher/Background.qml
Normal file
64
modules/launcher/Background.qml
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
Shape {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property real realWrapperHeight
|
||||||
|
readonly property int rounding: Appearance.rounding.large
|
||||||
|
readonly property int roundingY: Math.min(rounding, realWrapperHeight / 2)
|
||||||
|
readonly property real wrapperHeight: realWrapperHeight - 1 // Pixel issues :sob:
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
opacity: Appearance.transparency.enabled ? Appearance.transparency.base : 1
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
strokeWidth: -1
|
||||||
|
fillColor: Appearance.colours.m3surface
|
||||||
|
|
||||||
|
startY: root.wrapperHeight
|
||||||
|
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.rounding
|
||||||
|
relativeY: -root.roundingY
|
||||||
|
radiusX: root.rounding
|
||||||
|
radiusY: root.roundingY
|
||||||
|
direction: PathArc.Counterclockwise
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: 0
|
||||||
|
y: root.roundingY
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.rounding
|
||||||
|
relativeY: -root.roundingY
|
||||||
|
radiusX: root.rounding
|
||||||
|
radiusY: root.roundingY
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
x: wrapper.width - root.rounding * 2
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.rounding
|
||||||
|
relativeY: root.roundingY
|
||||||
|
radiusX: root.rounding
|
||||||
|
radiusY: root.roundingY
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: 0
|
||||||
|
y: root.wrapperHeight - root.roundingY
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.rounding
|
||||||
|
relativeY: root.roundingY
|
||||||
|
radiusX: root.rounding
|
||||||
|
radiusY: root.roundingY
|
||||||
|
direction: PathArc.Counterclockwise
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -26,126 +26,16 @@ Scope {
|
||||||
|
|
||||||
anchors.bottom: true
|
anchors.bottom: true
|
||||||
|
|
||||||
Shape {
|
Background {
|
||||||
id: bg
|
id: bg
|
||||||
|
|
||||||
readonly property int rounding: Appearance.rounding.large
|
realWrapperHeight: wrapper.height
|
||||||
readonly property int roundingY: Math.min(rounding, wrapper.height / 2)
|
|
||||||
readonly property real wrapperHeight: wrapper.height - 1 // Pixel issues :sob:
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
|
||||||
opacity: Appearance.transparency.enabled ? Appearance.transparency.base : 1
|
|
||||||
|
|
||||||
ShapePath {
|
|
||||||
strokeWidth: -1
|
|
||||||
fillColor: Appearance.colours.m3surface
|
|
||||||
|
|
||||||
startY: bg.wrapperHeight
|
|
||||||
|
|
||||||
PathArc {
|
|
||||||
relativeX: bg.rounding
|
|
||||||
relativeY: -bg.roundingY
|
|
||||||
radiusX: bg.rounding
|
|
||||||
radiusY: bg.roundingY
|
|
||||||
direction: PathArc.Counterclockwise
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
relativeX: 0
|
|
||||||
y: bg.roundingY
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: bg.rounding
|
|
||||||
relativeY: -bg.roundingY
|
|
||||||
radiusX: bg.rounding
|
|
||||||
radiusY: bg.roundingY
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
x: wrapper.width - bg.rounding * 2
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: bg.rounding
|
|
||||||
relativeY: bg.roundingY
|
|
||||||
radiusX: bg.rounding
|
|
||||||
radiusY: bg.roundingY
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
relativeX: 0
|
|
||||||
y: bg.wrapperHeight - bg.roundingY
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: bg.rounding
|
|
||||||
relativeY: bg.roundingY
|
|
||||||
radiusX: bg.rounding
|
|
||||||
radiusY: bg.roundingY
|
|
||||||
direction: PathArc.Counterclockwise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Wrapper {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
|
|
||||||
anchors.left: parent.left
|
launcherVisible: root.launcherVisible
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
|
|
||||||
height: 0
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
states: State {
|
|
||||||
name: "visible"
|
|
||||||
when: root.launcherVisible
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
wrapper.height: content.height
|
|
||||||
wrapper.visible: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transitions: [
|
|
||||||
Transition {
|
|
||||||
from: ""
|
|
||||||
to: "visible"
|
|
||||||
|
|
||||||
SequentialAnimation {
|
|
||||||
PropertyAction {
|
|
||||||
target: wrapper
|
|
||||||
property: "visible"
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
target: wrapper
|
|
||||||
property: "height"
|
|
||||||
duration: Appearance.anim.durations.large
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Transition {
|
|
||||||
from: "visible"
|
|
||||||
to: ""
|
|
||||||
|
|
||||||
SequentialAnimation {
|
|
||||||
NumberAnimation {
|
|
||||||
target: wrapper
|
|
||||||
property: "height"
|
|
||||||
duration: Appearance.anim.durations.extraLarge
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: wrapper
|
|
||||||
property: "visible"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
PaddedRect {
|
PaddedRect {
|
||||||
id: content
|
id: content
|
||||||
|
|
|
||||||
66
modules/launcher/Wrapper.qml
Normal file
66
modules/launcher/Wrapper.qml
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property bool launcherVisible
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
height: 0
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "visible"
|
||||||
|
when: root.launcherVisible
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.height: content.height
|
||||||
|
root.visible: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: ""
|
||||||
|
to: "visible"
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
PropertyAction {
|
||||||
|
target: root
|
||||||
|
property: "visible"
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "height"
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "visible"
|
||||||
|
to: ""
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "height"
|
||||||
|
duration: Appearance.anim.durations.extraLarge
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
|
}
|
||||||
|
PropertyAction {
|
||||||
|
target: root
|
||||||
|
property: "visible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue