File indexing completed on 2024-06-16 07:42:03

0001 /*
0002     SPDX-FileCopyrightText: 2003-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-FileCopyrightText: 2011 Michal Malek <michalm@jabster.pl>
0004     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 
0010 #ifndef _K3BCDCOPYJOB_H_
0011 #define _K3BCDCOPYJOB_H_
0012 
0013 #include "k3bjob.h"
0014 #include "k3b_export.h"
0015 #include "k3bglobals.h"
0016 
0017 #include <KCDDB/KCDDB>
0018 
0019 namespace K3b {
0020     namespace Device {
0021         class Device;
0022         class DeviceHandler;
0023     }
0024 
0025 
0026 /**
0027  *@author Sebastian Trueg
0028  */
0029     class LIBK3B_EXPORT CdCopyJob : public BurnJob
0030     {
0031         Q_OBJECT
0032 
0033     public:
0034         explicit CdCopyJob( JobHandler* hdl, QObject* parent = 0 );
0035         ~CdCopyJob() override;
0036 
0037         Device::Device* writer() const override { return m_onlyCreateImages ? 0 : m_writerDevice; }
0038         Device::Device* reader() const { return m_readerDevice; }
0039 
0040         QString jobDescription() const override;
0041         QString jobDetails() const override;
0042         
0043         QString jobSource() const override;
0044         QString jobTarget() const override;
0045 
0046     public Q_SLOTS:
0047         void start() override;
0048         void cancel() override;
0049 
0050     public:
0051         void setWriterDevice( K3b::Device::Device* dev ) { m_writerDevice = dev; }
0052         void setReaderDevice( K3b::Device::Device* dev ) { m_readerDevice = dev; }
0053         void setWritingMode( K3b::WritingMode m ) { m_writingMode = m; }
0054         void setSpeed( int s ) { m_speed = s; }
0055         void setOnTheFly( bool b ) { m_onTheFly = b; }
0056         void setKeepImage( bool b ) { m_keepImage = b; }
0057         void setOnlyCreateImage( bool b ) { m_onlyCreateImages = b; }
0058         void setSimulate( bool b ) { m_simulate = b; }
0059         void setTempPath( const QString& path ) { m_tempPath= path; }
0060         void setCopies( unsigned int c ) { m_copies = c; }
0061         void setParanoiaMode( int i ) { m_paranoiaMode = i; }
0062         void setIgnoreDataReadErrors( bool b ) { m_ignoreDataReadErrors = b; }
0063         void setDataReadRetries( int i ) { m_dataReadRetries = i; }
0064         void setIgnoreAudioReadErrors( bool b ) { m_ignoreAudioReadErrors = b; }
0065         void setAudioReadRetries( int i ) { m_audioReadRetries = i; }
0066         void setCopyCdText( bool b ) { m_copyCdText = b; }
0067         void setNoCorrection( bool b ) { m_noCorrection = b; }
0068 
0069     private Q_SLOTS:
0070         void slotDiskInfoReady( K3b::Device::DeviceHandler* );
0071         void slotCdTextReady( K3b::Device::DeviceHandler* );
0072         void slotMediaReloadedForNextSession( K3b::Device::DeviceHandler* dh );
0073         void slotCddbQueryFinished( KCDDB::Result );
0074         void slotWritingNextTrack( int t, int tt );
0075         void slotReadingNextTrack( int t, int tt );
0076         void slotSessionReaderFinished( bool success );
0077         void slotWriterFinished( bool success );
0078         void slotReaderProgress( int p );
0079         void slotReaderSubProgress( int p );
0080         void slotWriterProgress( int p );
0081         void slotReaderProcessedSize( int p, int pp );
0082 
0083     private:
0084         void startCopy();
0085         void searchCdText();
0086         void queryCddb();
0087         bool writeNextSession();
0088         void readNextSession();
0089         bool prepareImageFiles();
0090         void cleanup();
0091         void finishJob( bool canceled, bool error );
0092 
0093         Device::Device* m_writerDevice;
0094         Device::Device* m_readerDevice;
0095         bool m_simulate;
0096         int m_speed;
0097         int m_paranoiaMode;
0098         int m_copies;
0099         bool m_keepImage;
0100         bool m_onlyCreateImages;
0101         bool m_onTheFly;
0102         bool m_ignoreDataReadErrors;
0103         bool m_ignoreAudioReadErrors;
0104         bool m_noCorrection;
0105         int m_dataReadRetries;
0106         int m_audioReadRetries;
0107         bool m_copyCdText;
0108         QString m_tempPath;
0109         WritingMode m_writingMode;
0110 
0111         class Private;
0112         Private* d;
0113     };
0114 }
0115 
0116 #endif