forked from qt-creator/qt-creator
ScreenRecorder: Add setting for capturing the mouse cursor
This adds a boolean setting for capturing the mouse cursor which is by default true. macOS would otherwise not capture it by default. Change-Id: Ic70eb4c70e1be8c452ff32ef6c54f072ccc31caa Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -322,6 +322,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
||||
Internal::settings().recordSettings();
|
||||
const QString frameRateStr = QString::number(rS.frameRate);
|
||||
const QString screenIdStr = QString::number(rS.screenId);
|
||||
const QString captureCursorStr = Internal::settings().captureCursor() ? "1" : "0";
|
||||
QStringList videoGrabParams;
|
||||
// see http://trac.ffmpeg.org/wiki/Capture/Desktop
|
||||
switch (HostOsInfo::hostOs()) {
|
||||
@@ -334,6 +335,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
||||
? screen->size() * screen->devicePixelRatio()
|
||||
: rS.cropRect.size());
|
||||
videoGrabParams.append({"-f", "x11grab"});
|
||||
videoGrabParams.append({"-draw_mouse", captureCursorStr});
|
||||
videoGrabParams.append({"-framerate", frameRateStr});
|
||||
videoGrabParams.append({"-video_size", videoSize});
|
||||
videoGrabParams.append({"-i", QString("%1+%2,%3").arg(x11display)
|
||||
@@ -348,6 +350,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
||||
.arg(rS.cropRect.y()));
|
||||
}
|
||||
filter.append(":framerate=" + frameRateStr);
|
||||
filter.append(":draw_mouse=" + captureCursorStr);
|
||||
filter.append(",hwdownload");
|
||||
filter.append(",format=bgra");
|
||||
videoGrabParams = {
|
||||
@@ -359,6 +362,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
||||
case OsTypeMac: {
|
||||
videoGrabParams = {
|
||||
"-f", "avfoundation",
|
||||
"-capture_cursor", captureCursorStr,
|
||||
"-framerate", frameRateStr,
|
||||
"-pixel_format", "bgr0",
|
||||
"-i", QString("Capture screen %1:none").arg(rS.screenId),
|
||||
|
||||
@@ -67,6 +67,11 @@ ScreenRecorderSettings::ScreenRecorderSettings()
|
||||
ffprobeTool.setDefaultValue(ffprobeDefault.toUserOutput());
|
||||
ffprobeTool.setLabelText(Tr::tr("ffprobe tool:"));
|
||||
|
||||
captureCursor.setSettingsKey("CaptureCursor");
|
||||
captureCursor.setDefaultValue(true);
|
||||
captureCursor.setLabel(Tr::tr("Capture the mouse cursor"));
|
||||
captureCursor.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
|
||||
|
||||
enableFileSizeLimit.setSettingsKey("EnableFileSizeLimit");
|
||||
enableFileSizeLimit.setDefaultValue(true);
|
||||
enableFileSizeLimit.setLabel(Tr::tr("Size limit for intermediate output file"));
|
||||
@@ -145,6 +150,7 @@ ScreenRecorderSettings::ScreenRecorderSettings()
|
||||
Group {
|
||||
title(Tr::tr("Record settings")),
|
||||
Column {
|
||||
captureCursor,
|
||||
Row { enableFileSizeLimit, fileSizeLimit, st },
|
||||
Row { enableRtBuffer, rtBufferSize, st },
|
||||
},
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
|
||||
#include <utils/aspects.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QScreen;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ScreenRecorder::Internal {
|
||||
|
||||
class ScreenRecorderSettings : public Utils::AspectContainer
|
||||
@@ -30,6 +26,7 @@ public:
|
||||
// Visible in Settings page
|
||||
Utils::FilePathAspect ffmpegTool{this};
|
||||
Utils::FilePathAspect ffprobeTool{this};
|
||||
Utils::BoolAspect captureCursor{this};
|
||||
Utils::BoolAspect enableFileSizeLimit{this};
|
||||
Utils::IntegerAspect fileSizeLimit{this}; // in MB
|
||||
Utils::BoolAspect enableRtBuffer{this};
|
||||
|
||||
Reference in New Issue
Block a user