2022-05-19 23:59:30 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Window 2.15
|
|
|
|
|
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
2022-05-19 23:59:30 +00:00
|
|
|
import org.kde.pipewire.record 0.1 as PWRec
|
2022-06-22 23:59:23 +00:00
|
|
|
import org.kde.taskmanager 0.1 as TaskManager
|
2022-10-12 16:00:12 +00:00
|
|
|
import org.kde.plasma.quicksetting.record 1.0
|
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
|
2022-10-12 16:00:12 +00:00
|
|
|
text: switch (record.state) {
|
2022-05-19 23:59:30 +00:00
|
|
|
case PWRec.PipeWireRecord.Idle:
|
2022-08-17 02:44:20 +00:00
|
|
|
return i18n("Record Screen")
|
2022-05-19 23:59:30 +00:00
|
|
|
case PWRec.PipeWireRecord.Recording:
|
2022-08-17 02:44:20 +00:00
|
|
|
return i18n("Recording…")
|
2022-05-19 23:59:30 +00:00
|
|
|
case PWRec.PipeWireRecord.Rendering:
|
2022-08-17 02:44:20 +00:00
|
|
|
i18n("Writing…")
|
2022-05-19 23:59:30 +00:00
|
|
|
}
|
|
|
|
|
status: switch(record.state) {
|
|
|
|
|
case PWRec.PipeWireRecord.Idle:
|
2022-08-17 02:44:20 +00:00
|
|
|
return i18n("Tap to start recording")
|
2022-05-19 23:59:30 +00:00
|
|
|
case PWRec.PipeWireRecord.Recording:
|
2022-08-17 02:44:20 +00:00
|
|
|
return i18n("Screen is being captured…")
|
2022-05-19 23:59:30 +00:00
|
|
|
case PWRec.PipeWireRecord.Rendering:
|
2022-08-17 02:44:20 +00:00
|
|
|
i18n("Please wait…")
|
2022-05-19 23:59:30 +00:00
|
|
|
}
|
|
|
|
|
icon: "media-record"
|
|
|
|
|
enabled: false
|
|
|
|
|
|
|
|
|
|
function toggle() {
|
|
|
|
|
if (!record.active) {
|
2022-10-12 16:00:12 +00:00
|
|
|
record.output = RecordUtil.videoLocation("screen-recording.mp4");
|
2022-05-19 23:59:30 +00:00
|
|
|
} else {
|
2022-10-12 16:00:12 +00:00
|
|
|
RecordUtil.showNotification(i18n("New Screen Recording"), i18n("New Screen Recording saved in %1", record.output), record.output);
|
2022-05-19 23:59:30 +00:00
|
|
|
}
|
2022-08-17 02:44:20 +00:00
|
|
|
|
2022-05-19 23:59:30 +00:00
|
|
|
enabled = !enabled
|
2023-03-20 01:32:19 +00:00
|
|
|
MobileShellState.ShellDBusClient.closeActionDrawer();
|
2022-05-19 23:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PWRec.PipeWireRecord {
|
|
|
|
|
id: record
|
|
|
|
|
nodeId: waylandItem.nodeId
|
|
|
|
|
active: root.enabled
|
|
|
|
|
}
|
2022-06-22 23:59:23 +00:00
|
|
|
TaskManager.ScreencastingRequest {
|
2022-05-19 23:59:30 +00:00
|
|
|
id: waylandItem
|
|
|
|
|
outputName: root.enabled ? Screen.name : ""
|
|
|
|
|
}
|
|
|
|
|
}
|