File indexing completed on 2024-04-28 04:49:42

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_CDRECORD_WRITER_H
0007 #define K3B_CDRECORD_WRITER_H
0008 
0009 
0010 #include "k3babstractwriter.h"
0011 
0012 #include <QProcess>
0013 #include <QStringList>
0014 
0015 namespace K3b {
0016     class ExternalBin;
0017     class Process;
0018     namespace Device {
0019         class Device;
0020     }
0021 
0022 
0023     class CdrecordWriter : public AbstractWriter
0024     {
0025         Q_OBJECT
0026 
0027     public:
0028         CdrecordWriter( Device::Device*, JobHandler* hdl,
0029                         QObject* parent = 0 );
0030         ~CdrecordWriter() override;
0031 
0032         bool active() const override;
0033 
0034         /**
0035          * to be used in chain: addArgument(x)->addArgument(y)
0036          */
0037         CdrecordWriter* addArgument( const QString& );
0038         void clearArguments();
0039 
0040         /**
0041          * Write to the writer process.
0042          * FIXME: make this an overloaded method from AbstractWriter
0043          */
0044         qint64 write( const char* data, qint64 maxSize );
0045 
0046         QIODevice* ioDevice() const override;
0047 
0048     public Q_SLOTS:
0049         void start() override;
0050         void cancel() override;
0051 
0052         void setDao( bool b );
0053         void setWritingMode( WritingMode mode );
0054         void setFormattingMode( FormattingMode mode );
0055         void setCueFile( const QString& s);
0056         void setClone( bool b );
0057         void setMulti( bool b );
0058         void setForce( bool b );
0059 
0060         void setRawCdText( const QByteArray& a );
0061 
0062     protected Q_SLOTS:
0063         void slotStdLine( const QString& line );
0064         void slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus );
0065         void slotThroughput( int t );
0066 
0067     protected:
0068         virtual bool prepareProcess();
0069 
0070         enum CdrecordError { UNKNOWN,
0071                              OVERSIZE,
0072                              BAD_OPTION,
0073                              SHMGET_FAILED,
0074                              OPC_FAILED,
0075                              CANNOT_SET_SPEED,
0076                              CANNOT_SEND_CUE_SHEET,
0077                              CANNOT_OPEN_NEW_SESSION,
0078                              CANNOT_FIXATE_DISK,
0079                              WRITE_ERROR,
0080                              PERMISSION_DENIED,
0081                              BUFFER_UNDERRUN,
0082                              HIGH_SPEED_MEDIUM,
0083                              LOW_SPEED_MEDIUM,
0084                              MEDIUM_ERROR,
0085                              DEVICE_BUSY,
0086                              BLANK_FAILED,
0087                              SHORT_READ };
0088 
0089     private:
0090         class Private;
0091         Private* d;
0092     };
0093 }
0094 
0095 #endif