WallPaperPanel/Selector: added LazyLoader and a smooth animation to reveal images once loaded (#78)
Co-authored-by: Sébastien Atoch <sebastien@atracktiv.com>
This commit is contained in:
parent
1175ebd485
commit
186fb315dc
2 changed files with 35 additions and 23 deletions
|
|
@ -59,8 +59,8 @@ PanelWithOverlay {
|
||||||
if (sidebarPopupRect.settingsModal && sidebarPopupRect.settingsModal.visible) {
|
if (sidebarPopupRect.settingsModal && sidebarPopupRect.settingsModal.visible) {
|
||||||
sidebarPopupRect.settingsModal.visible = false;
|
sidebarPopupRect.settingsModal.visible = false;
|
||||||
}
|
}
|
||||||
if (sidebarPopupRect.wallpaperPanelModal && sidebarPopupRect.wallpaperPanelModal.visible) {
|
if (wallpaperPanelLoader && wallpaperPanelLoader.active) {
|
||||||
sidebarPopupRect.wallpaperPanelModal.visible = false;
|
wallpaperPanelLoader.active = false;
|
||||||
}
|
}
|
||||||
if (sidebarPopupRect.wifiPanelModal && sidebarPopupRect.wifiPanelModal.visible) {
|
if (sidebarPopupRect.wifiPanelModal && sidebarPopupRect.wifiPanelModal.visible) {
|
||||||
sidebarPopupRect.wifiPanelModal.visible = false;
|
sidebarPopupRect.wifiPanelModal.visible = false;
|
||||||
|
|
@ -125,7 +125,6 @@ PanelWithOverlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias settingsModal: settingsModal
|
property alias settingsModal: settingsModal
|
||||||
property alias wallpaperPanelModal: wallpaperPanelModal
|
|
||||||
property alias wifiPanelModal: wifiPanel.panel
|
property alias wifiPanelModal: wifiPanel.panel
|
||||||
property alias bluetoothPanelModal: bluetoothPanel.panel
|
property alias bluetoothPanelModal: bluetoothPanel.panel
|
||||||
SettingsModal {
|
SettingsModal {
|
||||||
|
|
@ -313,9 +312,7 @@ PanelWithOverlay {
|
||||||
onSettingsRequested: {
|
onSettingsRequested: {
|
||||||
settingsModal.visible = true;
|
settingsModal.visible = true;
|
||||||
}
|
}
|
||||||
onWallpaperRequested: {
|
onWallpaperRequested: wallpaperPanelLoader.active = true;
|
||||||
wallpaperPanelModal.visible = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Keys.onEscapePressed: sidebarPopupRect.hidePopup()
|
Keys.onEscapePressed: sidebarPopupRect.hidePopup()
|
||||||
|
|
@ -402,16 +399,20 @@ PanelWithOverlay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LazyLoader {
|
||||||
|
id: wallpaperPanelLoader
|
||||||
|
loading: false
|
||||||
|
|
||||||
WallpaperPanel {
|
WallpaperPanel {
|
||||||
id: wallpaperPanelModal
|
// Need to keep this visible so it shows once loaded
|
||||||
visible: false
|
visible: true
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
wallpaperPanelModal.anchors.top = parent.top;
|
anchors.top = parent.top;
|
||||||
wallpaperPanelModal.anchors.right = parent.right;
|
anchors.right = parent.right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add a close button inside WallpaperPanel.qml for user to close the modal
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ PanelWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (wallpaperPanelModal.visible) {
|
if (wallpaperPanelLoader.active) {
|
||||||
wallpapers = WallpaperManager.wallpaperList
|
wallpapers = WallpaperManager.wallpaperList
|
||||||
} else {
|
} else {
|
||||||
wallpapers = []
|
wallpapers = []
|
||||||
|
|
@ -81,7 +81,7 @@ PanelWindow {
|
||||||
id: closeButtonArea
|
id: closeButtonArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: wallpaperPanelModal.visible = false
|
onClicked: wallpaperPanelLoader.active = false;
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -136,13 +136,24 @@ PanelWindow {
|
||||||
source: modelData
|
source: modelData
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
cache: true
|
cache: false
|
||||||
smooth: true
|
smooth: true
|
||||||
mipmap: true
|
mipmap: true
|
||||||
// Limit memory usage
|
// Limit memory usage
|
||||||
sourceSize.width: 480
|
sourceSize.width: 480
|
||||||
sourceSize.height: 270
|
sourceSize.height: 270
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.textPrimary
|
||||||
|
opacity: (wallpaperImage.status == Image.Ready) ? 0.0 : 1.0
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 500
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue