File indexing completed on 2025-02-02 04:26:13

0001 /* This file is part of Spectacle, the KDE screenshot utility
0002  * SPDX-FileCopyrightText: 2019 Boudhayan Gupta <bgupta@kde.org>
0003 
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #include "PlatformNull.h"
0008 
0009 #include <QDebug>
0010 #include <QPixmap>
0011 
0012 /* -- Null Platform ---------------------------------------------------------------------------- */
0013 
0014 ImagePlatformNull::ImagePlatformNull(QObject *parent)
0015     : ImagePlatform(parent)
0016 {
0017 }
0018 
0019 ImagePlatform::GrabModes ImagePlatformNull::supportedGrabModes() const
0020 {
0021     return {GrabMode::AllScreens | GrabMode::CurrentScreen | GrabMode::ActiveWindow | GrabMode::WindowUnderCursor | GrabMode::TransientWithParent
0022             | GrabMode::AllScreensScaled};
0023 }
0024 
0025 ImagePlatform::ShutterModes ImagePlatformNull::supportedShutterModes() const
0026 {
0027     return {ShutterMode::Immediate | ShutterMode::OnClick};
0028 }
0029 
0030 void ImagePlatformNull::doGrab(ShutterMode shutterMode, GrabMode grabMode, bool includePointer, bool includeDecorations, bool includeShadow)
0031 {
0032     Q_UNUSED(shutterMode)
0033     Q_UNUSED(grabMode)
0034     Q_UNUSED(includePointer)
0035     Q_UNUSED(includeDecorations)
0036     Q_UNUSED(includeShadow)
0037     Q_EMIT newScreenshotTaken();
0038 }
0039 
0040 VideoPlatformNull::VideoPlatformNull(QObject *parent)
0041     : VideoPlatform(parent)
0042 {
0043 }
0044 
0045 VideoPlatform::RecordingModes VideoPlatformNull::supportedRecordingModes() const
0046 {
0047     return {};
0048 }
0049 
0050 VideoPlatform::Formats VideoPlatformNull::supportedFormats() const
0051 {
0052     return {};
0053 }
0054 
0055 void VideoPlatformNull::startRecording(const QUrl &fileUrl, RecordingMode mode, const QVariant &, bool withPointer)
0056 {
0057     setRecording(true);
0058     m_fileUrl = fileUrl;
0059     qDebug() << "start recording" << mode << "pointer:" << withPointer << "url:" << fileUrl;
0060 }
0061 
0062 void VideoPlatformNull::finishRecording()
0063 {
0064     setRecording(false);
0065     qDebug() << "finish recording" << m_fileUrl;
0066     Q_EMIT recordingSaved(m_fileUrl);
0067 }
0068 
0069 
0070 
0071 #include "moc_PlatformNull.cpp"