188 lines
5.3 KiB
QML
188 lines
5.3 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import "root:/widgets"
|
|
import "root:/services"
|
|
import "root:/config"
|
|
import Quickshell
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property PersistentProperties visibilities
|
|
required property TextField search
|
|
required property int padding
|
|
required property int rounding
|
|
|
|
property bool showWallpapers: search.text.startsWith(`${LauncherConfig.actionPrefix}wallpaper `)
|
|
property var currentList: (showWallpapers ? wallpaperList : appList).item
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.bottom: parent.bottom
|
|
|
|
clip: true
|
|
state: showWallpapers ? "wallpapers" : "apps"
|
|
|
|
states: [
|
|
State {
|
|
name: "apps"
|
|
|
|
PropertyChanges {
|
|
root.implicitWidth: LauncherConfig.sizes.itemWidth
|
|
root.implicitHeight: Math.max(empty.height, appList.height)
|
|
appList.active: true
|
|
}
|
|
|
|
AnchorChanges {
|
|
anchors.left: root.parent.left
|
|
anchors.right: root.parent.right
|
|
}
|
|
},
|
|
State {
|
|
name: "wallpapers"
|
|
|
|
PropertyChanges {
|
|
root.implicitWidth: Math.max(LauncherConfig.sizes.itemWidth, wallpaperList.width)
|
|
root.implicitHeight: LauncherConfig.sizes.wallpaperHeight
|
|
wallpaperList.active: true
|
|
}
|
|
}
|
|
]
|
|
|
|
transitions: Transition {
|
|
SequentialAnimation {
|
|
NumberAnimation {
|
|
target: root
|
|
property: "opacity"
|
|
from: 1
|
|
to: 0
|
|
duration: Appearance.anim.durations.small
|
|
easing.type: Easing.BezierSpline
|
|
easing.bezierCurve: Appearance.anim.curves.standard
|
|
}
|
|
PropertyAction {
|
|
targets: [appList, wallpaperList]
|
|
properties: "active"
|
|
}
|
|
ParallelAnimation {
|
|
NumberAnimation {
|
|
target: root
|
|
properties: "implicitWidth,implicitHeight"
|
|
duration: Appearance.anim.durations.large
|
|
easing.type: Easing.BezierSpline
|
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
|
}
|
|
NumberAnimation {
|
|
target: root
|
|
property: "opacity"
|
|
from: 0
|
|
to: 1
|
|
duration: Appearance.anim.durations.large
|
|
easing.type: Easing.BezierSpline
|
|
easing.bezierCurve: Appearance.anim.curves.standard
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: appList
|
|
|
|
active: false
|
|
asynchronous: true
|
|
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
|
|
sourceComponent: AppList {
|
|
padding: root.padding
|
|
search: root.search
|
|
visibilities: root.visibilities
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: wallpaperList
|
|
|
|
active: false
|
|
asynchronous: true
|
|
|
|
anchors.top: parent.top
|
|
anchors.bottom: parent.bottom
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
sourceComponent: WallpaperList {
|
|
search: root.search
|
|
visibilities: root.visibilities
|
|
}
|
|
}
|
|
|
|
Item {
|
|
id: empty
|
|
|
|
opacity: root.currentList?.count === 0 ? 1 : 0
|
|
scale: root.currentList?.count === 0 ? 1 : 0.5
|
|
|
|
implicitWidth: icon.width + text.width + Appearance.spacing.small
|
|
implicitHeight: icon.height
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
MaterialIcon {
|
|
id: icon
|
|
|
|
text: "manage_search"
|
|
color: Colours.palette.m3onSurfaceVariant
|
|
font.pointSize: Appearance.font.size.extraLarge
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
|
|
StyledText {
|
|
id: text
|
|
|
|
anchors.left: icon.right
|
|
anchors.leftMargin: Appearance.spacing.small
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: qsTr("No results")
|
|
color: Colours.palette.m3onSurfaceVariant
|
|
font.pointSize: Appearance.font.size.larger
|
|
font.weight: 500
|
|
}
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation {
|
|
duration: Appearance.anim.durations.normal
|
|
easing.type: Easing.BezierSpline
|
|
easing.bezierCurve: Appearance.anim.curves.standard
|
|
}
|
|
}
|
|
|
|
Behavior on scale {
|
|
NumberAnimation {
|
|
duration: Appearance.anim.durations.normal
|
|
easing.type: Easing.BezierSpline
|
|
easing.bezierCurve: Appearance.anim.curves.standard
|
|
}
|
|
}
|
|
}
|
|
|
|
Behavior on implicitWidth {
|
|
NumberAnimation {
|
|
duration: Appearance.anim.durations.large
|
|
easing.type: Easing.BezierSpline
|
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
|
}
|
|
}
|
|
|
|
Behavior on implicitHeight {
|
|
NumberAnimation {
|
|
duration: Appearance.anim.durations.large
|
|
easing.type: Easing.BezierSpline
|
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
|
}
|
|
}
|
|
}
|