Improve wallpaper handling in initial start

- Use wallpaper directly from breeze instead of having our own copy
- Support dark theme wallpaper (if available)
This commit is contained in:
Carl Schwan 2024-01-27 17:49:30 +01:00
parent b630013ffa
commit 3eba3647e8
3 changed files with 13 additions and 8 deletions

View file

@ -41,12 +41,5 @@ qt_target_qml_sources(plasma-mobile-initial-start
qml/LandingComponent.qml
)
qt_add_resources(plasma-mobile-initial-start
PREFIX
"/"
FILES
assets/background.png
)
target_include_directories(plasma-mobile-initial-start PRIVATE ${CMAKE_BINARY_DIR})
install(TARGETS plasma-mobile-initial-start ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 KiB

View file

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtCore
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
@ -8,6 +9,7 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.mobileinitialstart.initialstart
import org.kde.plasma.mobileinitialstart.prepare 1.0 as Prepare
Item {
id: root
@ -38,7 +40,17 @@ Item {
Image {
id: backgroundImage
anchors.fill: parent
source: "qrc:/assets/background.png"
source: {
if (Prepare.PrepareUtil.usingDarkTheme) {
const wallpaperUrl = StandardPaths.locate(StandardPaths.GenericDataLocation, 'wallpapers/Next/contents/images_dark/720x1440.png');
if (!wallpaperUrl) {
return StandardPaths.locate(StandardPaths.GenericDataLocation, 'wallpapers/Next/contents/images/720x1440.png');
}
return wallpaperUrl;
} else {
return StandardPaths.locate(StandardPaths.GenericDataLocation, 'wallpapers/Next/contents/images/720x1440.png');
}
}
fillMode: Image.PreserveAspectCrop
opacity: 0