mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-27 15:02:50 -05:00
notifications: add image persistence
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
@@ -13,6 +12,19 @@ Rectangle {
|
||||
property bool hasImage: imageSource !== ""
|
||||
property alias imageStatus: internalImage.status
|
||||
|
||||
signal imageSaved(string filePath)
|
||||
|
||||
function saveImageToFile(filePath) {
|
||||
if (internalImage.status !== Image.Ready)
|
||||
return false;
|
||||
internalImage.grabToImage(function (result) {
|
||||
if (result && result.saveToFile(filePath)) {
|
||||
root.imageSaved(filePath);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
radius: width / 2
|
||||
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
|
||||
border.color: "transparent"
|
||||
@@ -67,7 +79,6 @@ Rectangle {
|
||||
visible: (internalImage.status !== Image.Ready || root.imageSource === "") && root.fallbackIcon !== ""
|
||||
}
|
||||
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
visible: root.imageSource === "" && root.fallbackIcon === "" && root.fallbackText !== ""
|
||||
|
||||
Reference in New Issue
Block a user