Warning, /plasma/kdeplasma-addons/wallpapers/potd/package/contents/ui/WallpaperPreview.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Window 2.0 // for Screen
0009 
0010 import org.kde.kirigami 2.12 as Kirigami // For Action and Units
0011 
0012 import org.kde.plasma.wallpapers.potd 1.0
0013 
0014 Column {
0015     id: wallpaperPreview
0016 
0017     spacing: 0
0018 
0019     /**
0020      * The background color of the preview area when the image is loaded
0021      */
0022     property alias backgroundColor: delegate.backgroundColor
0023 
0024     /**
0025      * The shadow height needs to be considered in the padding.
0026      */
0027     property alias shadowOffset: delegate.shadowOffset
0028 
0029     // Wallpaper preview (including save button)
0030     WallpaperDelegate {
0031         id: delegate
0032 
0033         width: Math.round(Screen.width / 10 + Kirigami.Units.smallSpacing * 2)
0034         height: Math.round(Screen.height / 10 + Kirigami.Units.smallSpacing * 2)
0035 
0036         localUrl: backend.localUrl
0037         infoUrl: backend.infoUrl
0038         title: backend.title
0039         author: backend.author
0040 
0041         thumbnailAvailable: !delegate.isNull
0042         thumbnailLoading: backend.loading
0043 
0044         actions: [
0045             Kirigami.Action {
0046                 icon.name: "document-save"
0047                 enabled: backend.localUrl.length > 0
0048                 visible: enabled
0049                 tooltip: i18ndc("plasma_wallpaper_org.kde.potd", "@action:inmenu wallpaper preview menu", "Save Image as…")
0050                 onTriggered: backend.saveImage()
0051 
0052                 Accessible.description: i18ndc("plasma_wallpaper_org.kde.potd", "@info:whatsthis for a button and a menu item", "Save today's picture to local disk")
0053             },
0054             Kirigami.Action {
0055                 icon.name: "internet-services"
0056                 enabled: backend.infoUrl.toString().length > 0
0057                 visible: false
0058                 tooltip: i18ndc("plasma_wallpaper_org.kde.potd", "@action:inmenu wallpaper preview menu, will open the website of the wallpaper", "Open Link in Browser…")
0059                 onTriggered: Qt.openUrlExternally(backend.infoUrl)
0060 
0061                 Accessible.description: i18ndc("plasma_wallpaper_org.kde.potd", "@info:whatsthis for a menu item", "Open the website of today's picture in the default browser")
0062             }
0063         ]
0064     }
0065 }