[plasma/spectacle] src: Mention that the video being recorded includes audio
Kai Uwe Broulik <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 6b09bc5c5da9573da0ba585cca2ce3cb107d201d by Kai Uwe Broulik.
Committed on 31/07/2026 at 08:23.
Pushed by broulik into branch 'master'.
Mention that the video being recorded includes audio
In case you forgot you turned that setting on.
M +5 -0 src/Platforms/PlatformNull.cpp
M +1 -0 src/Platforms/PlatformNull.h
M +1 -0 src/Platforms/VideoPlatform.h
M +5 -0 src/Platforms/VideoPlatformWayland.cpp
M +2 -0 src/Platforms/VideoPlatformWayland.h
M +6 -4 src/SpectacleCore.cpp
https://invent.kde.org/plasma/spectacle/-/commit/6b09bc5c5da9573da0ba585cca2ce3cb107d201d
diff --git a/src/Platforms/PlatformNull.cpp b/src/Platforms/PlatformNull.cpp
index 0bad71ada..042324b26 100644
--- a/src/Platforms/PlatformNull.cpp
+++ b/src/Platforms/PlatformNull.cpp
@@ -53,6 +53,11 @@ VideoPlatform::Formats VideoPlatformNull::supportedFormats() const
return {};
}
+bool VideoPlatformNull::isRecordingAudio() const
+{
+ return false;
+}
+
void VideoPlatformNull::startRecording(const QUrl &fileUrl, RecordingMode mode, const QVariantMap &options, bool withPointer)
{
Q_UNUSED(fileUrl)
diff --git a/src/Platforms/PlatformNull.h b/src/Platforms/PlatformNull.h
index 5c71d2b1d..aaf4c9b72 100644
--- a/src/Platforms/PlatformNull.h
+++ b/src/Platforms/PlatformNull.h
@@ -38,6 +38,7 @@ public:
RecordingModes supportedRecordingModes() const override;
Formats supportedFormats() const override;
+ bool isRecordingAudio() const override;
void startRecording(const QUrl &fileUrl, RecordingMode recordingMode, const QVariantMap &options, bool includePointer) override;
void finishRecording() override;
diff --git a/src/Platforms/VideoPlatform.h b/src/Platforms/VideoPlatform.h
index f8908ca1b..c76f33302 100644
--- a/src/Platforms/VideoPlatform.h
+++ b/src/Platforms/VideoPlatform.h
@@ -128,6 +128,7 @@ public:
Q_INVOKABLE static bool formatSupportsAudio(VideoPlatform::Format format);
bool isRecording() const;
+ virtual bool isRecordingAudio() const = 0;
qint64 recordedTime() const;
RecordingState recordingState() const;
diff --git a/src/Platforms/VideoPlatformWayland.cpp b/src/Platforms/VideoPlatformWayland.cpp
index 5cd829fb9..3a95bdaa6 100644
--- a/src/Platforms/VideoPlatformWayland.cpp
+++ b/src/Platforms/VideoPlatformWayland.cpp
@@ -148,6 +148,11 @@ VideoPlatform::Formats VideoPlatformWayland::supportedFormats() const
return formats;
}
+bool VideoPlatformWayland::isRecordingAudio() const
+{
+ return m_recorder && (m_recorder->recordMicrophone() || m_recorder->recordSystemAudio());
+}
+
void VideoPlatformWayland::startRecording(const QUrl &fileUrl, RecordingMode recordingMode, const QVariantMap &options, bool includePointer)
{
if (recordingMode == NoRecordingModes) {
diff --git a/src/Platforms/VideoPlatformWayland.h b/src/Platforms/VideoPlatformWayland.h
index e12f1f5c0..93f701ec3 100644
--- a/src/Platforms/VideoPlatformWayland.h
+++ b/src/Platforms/VideoPlatformWayland.h
@@ -26,6 +26,8 @@ public:
RecordingModes supportedRecordingModes() const override;
Formats supportedFormats() const override;
+ bool isRecordingAudio() const override;
+
void startRecording(const QUrl &fileUrl, RecordingMode recordingMode, const QVariantMap &options, bool includePointer) override;
void finishRecording() override;
diff --git a/src/SpectacleCore.cpp b/src/SpectacleCore.cpp
index 9431315b5..859941410 100644
--- a/src/SpectacleCore.cpp
+++ b/src/SpectacleCore.cpp
@@ -288,7 +288,7 @@ SpectacleCore::SpectacleCore(QObject *parent)
});
auto videoPlatform = m_videoPlatform.get();
- connect(videoPlatform, &VideoPlatform::recordingStateChanged, this, [this](VideoPlatform::RecordingState state) {
+ connect(videoPlatform, &VideoPlatform::recordingStateChanged, this, [this, videoPlatform](VideoPlatform::RecordingState state) {
if (state == VideoPlatform::RecordingState::Recording) {
static const auto recordingIcon = u":/icons/256-status-media-recording.webp"_s;
static const auto recordingStartedIcon = u":/icons/256-status-media-recording-started.webp"_s;
@@ -296,13 +296,15 @@ SpectacleCore::SpectacleCore(QObject *parent)
s_systemTrayIcon = std::make_unique<KStatusNotifierItem>();
s_systemTrayIcon->setStatus(KStatusNotifierItem::Active);
s_systemTrayIcon->setCategory(KStatusNotifierItem::SystemServices);
- s_systemTrayIcon->setToolTipTitle(i18nc("@info:tooltip title for recording tray icon", //
- "Spectacle is Recording"));
+ s_systemTrayIcon->setToolTipTitle(videoPlatform->isRecordingAudio()
+ ? i18nc("@info:tooltip title for recording tray icon", "Spectacle is Recording with Sound")
+ : i18nc("@info:tooltip title for recording tray icon", "Spectacle is Recording"));
s_systemTrayIcon->setStandardActionsEnabled(false);
connect(s_systemTrayIcon.get(), &KStatusNotifierItem::activateRequested, this, [] {
SpectacleCore::instance()->finishRecording();
});
- const auto messageTitle = i18nc("recording notification title", "Spectacle is Recording");
+ const auto messageTitle = videoPlatform->isRecordingAudio() ? i18nc("recording notification title", "Spectacle is Recording with Sound")
+ : i18nc("recording notification title", "Spectacle is Recording");
auto getSimpleDefaultShortcut = [] {
const auto shortcuts = KGlobalAccel::self()->shortcut(ShortcutActions::self()->recordRegionAction());
if (shortcuts.contains(QKeySequence{Qt::META | Qt::Key_R})) {