controlcenter: lazyloading applicatoins in launcher pane
This commit is contained in:
parent
f77323b136
commit
d9034ede8e
1 changed files with 64 additions and 50 deletions
|
|
@ -300,73 +300,87 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledListView {
|
Loader {
|
||||||
id: appsListView
|
id: appsListLoader
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
asynchronous: true
|
||||||
model: root.filteredApps
|
active: {
|
||||||
spacing: Appearance.spacing.small / 2
|
// Lazy load: activate when left pane is loaded
|
||||||
clip: true
|
// The ListView will load asynchronously, and search will work because filteredApps
|
||||||
|
// is updated regardless of whether the ListView is loaded
|
||||||
StyledScrollBar.vertical: StyledScrollBar {
|
return leftLauncherLoader.item !== null;
|
||||||
flickable: parent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: StyledRect {
|
sourceComponent: StyledListView {
|
||||||
required property var modelData
|
id: appsListView
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
width: parent ? parent.width : 0
|
model: root.filteredApps
|
||||||
|
spacing: Appearance.spacing.small / 2
|
||||||
|
clip: true
|
||||||
|
|
||||||
readonly property bool isSelected: root.selectedApp === modelData
|
StyledScrollBar.vertical: StyledScrollBar {
|
||||||
|
flickable: parent
|
||||||
color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent"
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
|
|
||||||
opacity: 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: 1000
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
delegate: StyledRect {
|
||||||
opacity = 1;
|
required property var modelData
|
||||||
}
|
|
||||||
|
|
||||||
StateLayer {
|
width: parent ? parent.width : 0
|
||||||
function onClicked(): void {
|
|
||||||
root.selectedApp = modelData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
readonly property bool isSelected: root.selectedApp === modelData
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.margins: Appearance.padding.normal
|
|
||||||
|
|
||||||
spacing: Appearance.spacing.normal
|
color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent"
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
|
||||||
IconImage {
|
opacity: 0
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
implicitSize: 32
|
Behavior on opacity {
|
||||||
source: {
|
NumberAnimation {
|
||||||
const entry = modelData.entry;
|
duration: 1000
|
||||||
return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing";
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
Component.onCompleted: {
|
||||||
Layout.fillWidth: true
|
opacity = 1;
|
||||||
text: modelData.name || modelData.entry?.name || qsTr("Unknown")
|
|
||||||
font.pointSize: Appearance.font.size.normal
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
implicitHeight: 40
|
StateLayer {
|
||||||
|
function onClicked(): void {
|
||||||
|
root.selectedApp = modelData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
implicitSize: 32
|
||||||
|
source: {
|
||||||
|
const entry = modelData.entry;
|
||||||
|
return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: modelData.name || modelData.entry?.name || qsTr("Unknown")
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitHeight: 40
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue