File indexing completed on 2024-05-05 04:51:12
0001 /* 0002 SPDX-FileCopyrightText: 2003 Klaus-Dieter Krannich <kd@k3b.org> 0003 SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 0009 #ifndef K3B_CDRDAO_WRITER_H 0010 #define K3B_CDRDAO_WRITER_H 0011 0012 #include "k3babstractwriter.h" 0013 #include "k3b_export.h" 0014 0015 #include <QProcess> 0016 0017 class QTcpSocket; 0018 0019 namespace K3b { 0020 class ExternalBin; 0021 class Process; 0022 0023 class LIBK3B_EXPORT CdrdaoWriter : public AbstractWriter 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 enum Command { WRITE, COPY, READ, BLANK }; 0029 enum SubMode { None, RW, RW_RAW }; 0030 0031 CdrdaoWriter( Device::Device* dev, JobHandler*, 0032 QObject* parent = 0 ); 0033 ~CdrdaoWriter() override; 0034 0035 /** 0036 * to be used in chain: addArgument(x)->addArgument(y) 0037 */ 0038 CdrdaoWriter* addArgument( const QString& ); 0039 Device::Device* sourceDevice() { return m_sourceDevice; }; 0040 0041 bool active() const override; 0042 0043 private: 0044 void reinitParser(); 0045 void parseCdrdaoLine( const QString& line ); 0046 void parseCdrdaoWrote( const QString& line ); 0047 void parseCdrdaoError( const QString& line ); 0048 0049 public Q_SLOTS: 0050 void start() override; 0051 void cancel() override; 0052 0053 // options 0054 // --------------------- 0055 void setCommand( int c ) { m_command = c; } 0056 void setBlankMode( FormattingMode b ) { m_blankMode = b; } 0057 void setMulti( bool b ) { m_multi = b; } 0058 void setForce( bool b ) { m_force = b; } 0059 void setOnTheFly( bool b ) { m_onTheFly = b; } 0060 void setDataFile( const QString& s ) { m_dataFile = s; } 0061 void setTocFile( const QString& s ) { m_tocFile = s; } 0062 0063 void setSourceDevice( Device::Device* dev ) { m_sourceDevice = dev; } 0064 void setFastToc( bool b ) { m_fastToc = b; } 0065 void setReadRaw( bool b ) { m_readRaw = b; } 0066 void setReadSubchan(SubMode m) { m_readSubchan=m; }; 0067 void setParanoiaMode( int i ) { m_paranoiaMode = i; } 0068 void setTaoSource(bool b) { m_taoSource=b; }; 0069 void setTaoSourceAdjust(int a) { m_taoSourceAdjust=a; }; 0070 void setSession(int s) { m_session=s; }; 0071 void setEject(bool e) { m_eject=e; }; 0072 // --------------------- 0073 0074 private Q_SLOTS: 0075 void slotStdLine( const QString& line ); 0076 void slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus ); 0077 void parseCdrdaoMessage(); 0078 void slotThroughput( int t ); 0079 0080 private: 0081 void unknownCdrdaoLine( const QString& ); 0082 void prepareArgumentList(); 0083 void setWriteArguments(); 0084 void setReadArguments(); 0085 void setCopyArguments(); 0086 void setBlankArguments(); 0087 void setCommonArguments(); 0088 0089 bool cueSheet(); 0090 0091 QString findDriverFile( const ExternalBin* bin ); 0092 bool defaultToGenericMMC( Device::Device* dev, bool writer ); 0093 0094 // options 0095 // --------------------- 0096 int m_command; 0097 int m_blankMode; 0098 Device::Device* m_sourceDevice; 0099 QString m_dataFile; 0100 QString m_tocFile; 0101 QString m_cueFileLnk; 0102 QString m_binFileLnk; 0103 QString m_backupTocFile; 0104 bool m_readRaw; 0105 bool m_multi; 0106 bool m_force; 0107 bool m_onTheFly; 0108 bool m_fastToc; 0109 SubMode m_readSubchan; 0110 bool m_taoSource; 0111 int m_taoSourceAdjust; 0112 int m_paranoiaMode; 0113 int m_session; 0114 bool m_eject; 0115 // --------------------- 0116 0117 const ExternalBin* m_cdrdaoBinObject; 0118 Process* m_process; 0119 0120 int m_cdrdaoComm[2]; 0121 QTcpSocket* m_comSock; 0122 0123 bool m_canceled; 0124 0125 bool m_knownError; 0126 0127 // parser 0128 0129 int m_size; 0130 int m_currentTrack; 0131 0132 class Private; 0133 Private* d; 0134 }; 0135 } 0136 0137 #endif