2025-06-14 01:16:20 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022-2025 Devin Lin <devin@kde.org>
|
2022-05-19 23:59:30 +00:00
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
2025-06-14 01:16:20 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Window
|
2022-05-19 23:59:30 +00:00
|
|
|
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
2025-06-14 01:16:20 +00:00
|
|
|
import org.kde.taskmanager as TaskManager
|
2025-04-18 20:13:55 +00:00
|
|
|
import org.kde.plasma.quicksetting.record
|
2023-03-17 02:44:36 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
2022-05-19 23:59:30 +00:00
|
|
|
|
2023-03-17 02:44:36 +00:00
|
|
|
QS.QuickSetting {
|
2022-05-19 23:59:30 +00:00
|
|
|
id: root
|
2025-06-14 01:16:20 +00:00
|
|
|
|
|
|
|
|
text: RecordUtil.quickSettingText
|
|
|
|
|
status: RecordUtil.quickSettingStatus
|
2025-04-06 17:03:53 +00:00
|
|
|
icon: "camera-video-symbolic"
|
2025-06-14 01:16:20 +00:00
|
|
|
enabled: RecordUtil.isRecording
|
|
|
|
|
available: true
|
2022-05-19 23:59:30 +00:00
|
|
|
|
|
|
|
|
function toggle() {
|
2025-06-14 01:16:20 +00:00
|
|
|
if (RecordUtil.isRecording) {
|
|
|
|
|
RecordUtil.stopRecording();
|
|
|
|
|
waylandItem.outputName = '';
|
2022-05-19 23:59:30 +00:00
|
|
|
} else {
|
2025-06-14 01:16:20 +00:00
|
|
|
// Start recording only when waylandItem's nodeId updates
|
|
|
|
|
waylandItem.startRecordingRequest = true;
|
|
|
|
|
waylandItem.outputName = Screen.name;
|
2022-05-19 23:59:30 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-22 23:59:23 +00:00
|
|
|
TaskManager.ScreencastingRequest {
|
2022-05-19 23:59:30 +00:00
|
|
|
id: waylandItem
|
2025-06-14 01:16:20 +00:00
|
|
|
property bool startRecordingRequest: false
|
|
|
|
|
|
|
|
|
|
onNodeIdChanged: {
|
|
|
|
|
if (startRecordingRequest) {
|
|
|
|
|
let status = RecordUtil.startRecording(waylandItem.nodeId);
|
|
|
|
|
if (status) {
|
|
|
|
|
MobileShellState.ShellDBusClient.closeActionDrawer();
|
|
|
|
|
} else {
|
|
|
|
|
waylandItem.outputName = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startRecordingRequest = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-19 23:59:30 +00:00
|
|
|
}
|
|
|
|
|
}
|