mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-30 09:32:05 -04:00
- adds log.info/error/debug/warn/fatal - adds ability to write logs to any file - add CLI options in addition to env to set log levels
38 lines
838 B
QML
38 lines
838 B
QML
pragma Singleton
|
|
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
|
|
Singleton {
|
|
id: root
|
|
readonly property var log: Log.scoped("MultimediaService")
|
|
|
|
property bool available: false
|
|
|
|
function detectAvailability() {
|
|
try {
|
|
const testObj = Qt.createQmlObject(`
|
|
import QtQuick
|
|
import QtMultimedia
|
|
import qs.Services
|
|
Item {}
|
|
`, root, "MultimediaService.TestComponent");
|
|
if (testObj) {
|
|
testObj.destroy();
|
|
}
|
|
available = true;
|
|
return true;
|
|
} catch (e) {
|
|
available = false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
if (!detectAvailability()) {
|
|
log.warn("QtMultimedia not available");
|
|
}
|
|
}
|
|
}
|