launcher: loader content
This commit is contained in:
parent
d06d8b870f
commit
302a82da2d
4 changed files with 61 additions and 51 deletions
|
|
@ -11,7 +11,6 @@ import QtQuick
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var wrapper
|
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
required property var panels
|
required property var panels
|
||||||
|
|
||||||
|
|
@ -21,9 +20,6 @@ Item {
|
||||||
implicitWidth: listWrapper.width + padding * 2
|
implicitWidth: listWrapper.width + padding * 2
|
||||||
implicitHeight: searchWrapper.height + listWrapper.height + padding * 2
|
implicitHeight: searchWrapper.height + listWrapper.height + padding * 2
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: listWrapper
|
id: listWrapper
|
||||||
|
|
||||||
|
|
@ -37,7 +33,7 @@ Item {
|
||||||
ContentList {
|
ContentList {
|
||||||
id: list
|
id: list
|
||||||
|
|
||||||
wrapper: root.wrapper
|
content: root
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
panels: root.panels
|
panels: root.panels
|
||||||
search: search
|
search: search
|
||||||
|
|
@ -129,23 +125,19 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: forceActiveFocus()
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.visibilities
|
target: root.visibilities
|
||||||
|
|
||||||
function onLauncherChanged(): void {
|
function onLauncherChanged(): void {
|
||||||
if (root.visibilities.launcher)
|
if (!root.visibilities.launcher)
|
||||||
search.focus = true;
|
|
||||||
else {
|
|
||||||
search.text = "";
|
search.text = "";
|
||||||
const current = list.currentList;
|
|
||||||
if (current)
|
|
||||||
current.currentIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSessionChanged(): void {
|
function onSessionChanged(): void {
|
||||||
if (root.visibilities.launcher && !root.visibilities.session)
|
if (!root.visibilities.session)
|
||||||
search.focus = true;
|
search.forceActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import QtQuick.Controls
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var wrapper
|
required property var content
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
required property var panels
|
required property var panels
|
||||||
required property TextField search
|
required property TextField search
|
||||||
|
|
@ -77,7 +77,6 @@ Item {
|
||||||
id: appList
|
id: appList
|
||||||
|
|
||||||
active: false
|
active: false
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
@ -92,7 +91,6 @@ Item {
|
||||||
id: wallpaperList
|
id: wallpaperList
|
||||||
|
|
||||||
active: false
|
active: false
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
@ -102,7 +100,7 @@ Item {
|
||||||
search: root.search
|
search: root.search
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
panels: root.panels
|
panels: root.panels
|
||||||
wrapper: root.wrapper
|
content: root.content
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ PathView {
|
||||||
required property TextField search
|
required property TextField search
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
required property var panels
|
required property var panels
|
||||||
required property var wrapper
|
required property var content
|
||||||
|
|
||||||
readonly property int itemWidth: Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2
|
readonly property int itemWidth: Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ PathView {
|
||||||
|
|
||||||
// Screen width - 4x outer rounding - 2x max side thickness (cause centered)
|
// Screen width - 4x outer rounding - 2x max side thickness (cause centered)
|
||||||
let outerMargins = Math.max(Config.border.thickness, panels.bar.implicitWidth);
|
let outerMargins = Math.max(Config.border.thickness, panels.bar.implicitWidth);
|
||||||
if (panels.popouts.hasCurrent && panels.popouts.currentCenter + panels.popouts.nonAnimHeight / 2 > screen.height - wrapper.implicitHeight - Config.border.thickness * 2)
|
if (panels.popouts.hasCurrent && panels.popouts.currentCenter + panels.popouts.nonAnimHeight / 2 > screen.height - content.implicitHeight - Config.border.thickness * 2)
|
||||||
outerMargins = panels.bar.implicitWidth + panels.popouts.nonAnimWidth;
|
outerMargins = panels.bar.implicitWidth + panels.popouts.nonAnimWidth;
|
||||||
const maxWidth = screen.width - Config.border.rounding * 4 - outerMargins * 2;
|
const maxWidth = screen.width - Config.border.rounding * 4 - outerMargins * 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.components
|
import qs.components
|
||||||
import qs.config
|
import qs.config
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|
@ -9,48 +11,66 @@ Item {
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
required property var panels
|
required property var panels
|
||||||
|
|
||||||
|
readonly property bool shouldBeActive: visibilities.launcher && Config.launcher.enabled
|
||||||
|
property int contentHeight
|
||||||
|
|
||||||
visible: height > 0
|
visible: height > 0
|
||||||
implicitHeight: 0
|
implicitHeight: 0
|
||||||
implicitWidth: content.implicitWidth
|
implicitWidth: content.implicitWidth
|
||||||
|
|
||||||
states: State {
|
onShouldBeActiveChanged: {
|
||||||
name: "visible"
|
if (shouldBeActive) {
|
||||||
when: root.visibilities.launcher && Config.launcher.enabled
|
hideAnim.stop();
|
||||||
|
showAnim.start();
|
||||||
PropertyChanges {
|
} else {
|
||||||
root.implicitHeight: content.implicitHeight
|
showAnim.stop();
|
||||||
|
hideAnim.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transitions: [
|
SequentialAnimation {
|
||||||
Transition {
|
id: showAnim
|
||||||
from: ""
|
|
||||||
to: "visible"
|
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
target: root
|
target: root
|
||||||
property: "implicitHeight"
|
property: "implicitHeight"
|
||||||
|
to: root.contentHeight
|
||||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
}
|
}
|
||||||
},
|
ScriptAction {
|
||||||
Transition {
|
script: root.implicitHeight = Qt.binding(() => content.implicitHeight)
|
||||||
from: "visible"
|
}
|
||||||
to: ""
|
}
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: hideAnim
|
||||||
|
|
||||||
|
ScriptAction {
|
||||||
|
script: root.implicitHeight = root.implicitHeight
|
||||||
|
}
|
||||||
Anim {
|
Anim {
|
||||||
target: root
|
target: root
|
||||||
property: "implicitHeight"
|
property: "implicitHeight"
|
||||||
|
to: 0
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
|
||||||
Content {
|
Loader {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
wrapper: root
|
anchors.top: parent.top
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
root.contentHeight = implicitHeight;
|
||||||
|
active = Qt.binding(() => root.shouldBeActive || root.visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceComponent: Content {
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
panels: root.panels
|
panels: root.panels
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue