mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-13 07:42:46 -04:00
quickshell: drop support for 0.2, require 0.3+
- Remove all compat code - Rewire LegacyNetworkService to use Quickshell.Networking - Add parentWindow to settings child windows
This commit is contained in:
@@ -15,7 +15,7 @@ Item {
|
||||
property bool inputEnabled: false
|
||||
property point lastMousePos: Qt.point(-1, -1)
|
||||
property bool mouseInitialized: false
|
||||
property var videoPlayer: null
|
||||
readonly property var videoPlayer: playerLoader.item
|
||||
|
||||
signal dismissed
|
||||
|
||||
@@ -27,6 +27,24 @@ Item {
|
||||
anchors.fill: parent
|
||||
color: "black"
|
||||
visible: root.active
|
||||
|
||||
Loader {
|
||||
id: playerLoader
|
||||
anchors.fill: parent
|
||||
active: false
|
||||
source: "VideoScreensaverPlayer.qml"
|
||||
onLoaded: {
|
||||
item.errorOccurred.connect((error, errorString) => {
|
||||
log.warn("playback error:", errorString);
|
||||
ToastService.showError(I18n.tr("Video Screensaver"), I18n.tr("Playback error: ") + errorString);
|
||||
root.dismiss();
|
||||
});
|
||||
if (root.videoSource) {
|
||||
item.source = root.videoSource;
|
||||
item.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -82,43 +100,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function createVideoPlayer() {
|
||||
if (videoPlayer)
|
||||
return true;
|
||||
|
||||
try {
|
||||
videoPlayer = Qt.createQmlObject(`
|
||||
import QtQuick
|
||||
import QtMultimedia
|
||||
Video {
|
||||
anchors.fill: parent
|
||||
fillMode: VideoOutput.PreserveAspectCrop
|
||||
loops: MediaPlayer.Infinite
|
||||
volume: 0
|
||||
}
|
||||
`, background, "VideoScreensaver.VideoPlayer");
|
||||
|
||||
videoPlayer.errorOccurred.connect((error, errorString) => {
|
||||
log.warn("playback error:", errorString);
|
||||
ToastService.showError(I18n.tr("Video Screensaver"), I18n.tr("Playback error: ") + errorString);
|
||||
root.dismiss();
|
||||
});
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
log.warn("Failed to create video player:", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function destroyVideoPlayer() {
|
||||
if (videoPlayer) {
|
||||
videoPlayer.stop();
|
||||
videoPlayer.destroy();
|
||||
videoPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function start() {
|
||||
if (!SettingsData.lockScreenVideoEnabled || !SettingsData.lockScreenVideoPath)
|
||||
return;
|
||||
@@ -128,8 +109,12 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!createVideoPlayer())
|
||||
playerLoader.active = true;
|
||||
if (playerLoader.status === Loader.Error) {
|
||||
log.warn("Failed to load video player");
|
||||
playerLoader.active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
videoPicker.result = "";
|
||||
videoPicker.folder = "";
|
||||
@@ -144,7 +129,9 @@ Item {
|
||||
function dismiss() {
|
||||
if (!active)
|
||||
return;
|
||||
destroyVideoPlayer();
|
||||
if (videoPlayer)
|
||||
videoPlayer.stop();
|
||||
playerLoader.active = false;
|
||||
inputEnabled = false;
|
||||
active = false;
|
||||
videoSource = "";
|
||||
|
||||
Reference in New Issue
Block a user