File indexing completed on 2024-05-12 04:51:52

0001 /*
0002     SPDX-FileCopyrightText: 2006-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef _K3B_VIDEODVD_RIPPING_PREVIEW_H_
0009 #define _K3B_VIDEODVD_RIPPING_PREVIEW_H_
0010 
0011 #include <QObject>
0012 #include <QProcess>
0013 #include <QScopedPointer>
0014 #include <QImage>
0015 
0016 #include "k3bvideodvd.h"
0017 
0018 
0019 class QTemporaryDir;
0020 
0021 namespace K3b {
0022     class Process;
0023 
0024     class VideoDVDRippingPreview : public QObject
0025     {
0026         Q_OBJECT
0027 
0028     public:
0029         explicit VideoDVDRippingPreview( QObject* parent = 0 );
0030         ~VideoDVDRippingPreview() override;
0031 
0032         QImage preview() const { return m_preview; }
0033 
0034     public Q_SLOTS:
0035         /**
0036          * \param dvd The Video DVD object
0037          * \param title The Video DVD title to generate the preview for
0038          * \param chapter The Chapter number to use for the preview.
0039          *                If 0 the middle of the title is used.
0040          */
0041         void generatePreview( const VideoDVD::VideoDVD& dvd, int title, int chapter = 0 );
0042 
0043         void cancel();
0044 
0045     Q_SIGNALS:
0046         void previewDone( bool );
0047 
0048     private Q_SLOTS:
0049         void slotTranscodeFinished( int exitCode, QProcess::ExitStatus status );
0050 
0051     private:
0052         QImage m_preview;
0053         QScopedPointer<QTemporaryDir> m_tempDir;
0054         Process* m_process;
0055         int m_title;
0056         int m_chapter;
0057         VideoDVD::VideoDVD m_dvd;
0058 
0059         bool m_canceled;
0060     };
0061 }
0062 
0063 #endif