File indexing completed on 2024-04-21 03:49:48
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2013 Illya Kovalevskyy <illya.kovalevskyy@gmail.com> 0004 // 0005 0006 #ifndef MOVIECAPTURE_H 0007 #define MOVIECAPTURE_H 0008 0009 #include <QObject> 0010 #include <QVector> 0011 0012 #include "marble_export.h" 0013 0014 namespace Marble 0015 { 0016 0017 class MarbleWidget; 0018 0019 class MovieCapturePrivate; 0020 0021 class MovieFormat 0022 { 0023 public: 0024 MovieFormat() {} 0025 explicit MovieFormat( const QString &type, const QString &name, const QString &extension) : 0026 m_type( type ), 0027 m_name( name ), 0028 m_extension( extension ) 0029 {} 0030 0031 QString type() const { return m_type; } 0032 QString name() const { return m_name; } 0033 QString extension() const { return m_extension; } 0034 private: 0035 QString m_type; 0036 QString m_name; 0037 QString m_extension; 0038 }; 0039 0040 class MARBLE_EXPORT MovieCapture : public QObject 0041 { 0042 Q_OBJECT 0043 public: 0044 enum SnapshotMethod { TimeDriven, DataDriven }; 0045 MovieCapture(MarbleWidget *widget, QObject *parent); 0046 ~MovieCapture() override; 0047 0048 int fps() const; 0049 QString destination() const; 0050 QVector<MovieFormat> availableFormats(); 0051 MovieCapture::SnapshotMethod snapshotMethod() const; 0052 bool checkToolsAvailability(); 0053 0054 public Q_SLOTS: 0055 void setFps(int fps); 0056 void setFilename(const QString &path); 0057 void setSnapshotMethod(MovieCapture::SnapshotMethod method); 0058 void recordFrame(); 0059 bool startRecording(); 0060 void stopRecording(); 0061 void cancelRecording(); 0062 0063 private Q_SLOTS: 0064 void processWrittenMovie(int exitCode); 0065 0066 Q_SIGNALS: 0067 void rateCalculated( double ); 0068 void errorOccured(); 0069 0070 protected: 0071 MovieCapturePrivate * const d_ptr; 0072 0073 private: 0074 Q_DECLARE_PRIVATE(MovieCapture) 0075 QVector<MovieFormat> m_supportedFormats; 0076 0077 }; 0078 0079 } // namespace Marble 0080 0081 Q_DECLARE_TYPEINFO(Marble::MovieFormat, Q_MOVABLE_TYPE); 0082 0083 #endif // MOVIECAPTURE_H