File indexing completed on 2024-05-05 04:50:58

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_READCD_READER_H_
0007 #define _K3B_READCD_READER_H_
0008 
0009 #include "k3bjob.h"
0010 
0011 #include <QProcess>
0012 
0013 namespace K3b {
0014 
0015     namespace Device {
0016         class Device;
0017     }
0018 
0019     class Msf;
0020 
0021     class ReadcdReader : public Job
0022     {
0023         Q_OBJECT
0024 
0025     public:
0026         explicit ReadcdReader( JobHandler*, QObject* parent = 0 );
0027         ~ReadcdReader() override;
0028 
0029         bool active() const override;
0030 
0031     public Q_SLOTS:
0032         void start() override;
0033         void cancel() override;
0034 
0035         void setReadDevice( K3b::Device::Device* dev ) { m_readDevice = dev; }
0036 
0037         /** 0 means MAX */
0038         void setReadSpeed( int s ) { m_speed = s; }
0039         void setDisableCorrection( bool b ) { m_noCorr = b; }
0040 
0041         /** default: true */
0042         void setAbortOnError( bool b ) { m_noError = !b; }
0043         void setC2Scan( bool b ) { m_c2Scan = b; }
0044         void setClone( bool b ) { m_clone = b; }
0045         void setRetries( int i ) { m_retries = i; }
0046 
0047         void setSectorRange( const Msf&, const Msf& );
0048 
0049         void setImagePath( const QString& p ) { m_imagePath = p; }
0050 
0051         /**
0052          * the data gets written directly into device instead of the imagefile.
0053          * Be aware that this only makes sense before starting the job.
0054          * To disable just set ioDev to 0
0055          */
0056         void writeTo( QIODevice* ioDev );
0057 
0058     private Q_SLOTS:
0059         void slotStderrLine( const QString& line );
0060         void slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus );
0061         void slotReadyRead();
0062 
0063     private:
0064         bool m_noCorr;
0065         bool m_clone;
0066         bool m_noError;
0067         bool m_c2Scan;
0068         int m_speed;
0069         int m_retries;
0070 
0071         Device::Device* m_readDevice;
0072 
0073         QString m_imagePath;
0074 
0075         class Private;
0076         Private* d;
0077     };
0078 }
0079 
0080 #endif