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

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef K3BDATAJOB_H
0007 #define K3BDATAJOB_H
0008 
0009 #include "k3bjob.h"
0010 #include "k3bdatadoc.h"
0011 
0012 #include <QFile>
0013 
0014 class QString;
0015 
0016 namespace K3b {
0017 
0018     class AbstractWriter;
0019     class IsoImager;
0020 
0021     namespace Device {
0022         class Device;
0023     }
0024 
0025     class DataJob : public BurnJob
0026     {
0027         Q_OBJECT
0028 
0029     public:
0030         DataJob( DataDoc*, JobHandler*, QObject* parent = 0 );
0031         ~DataJob() override;
0032 
0033         Doc* doc() const;
0034         Device::Device* writer() const override;
0035 
0036         bool hasBeenCanceled() const override;
0037 
0038         QString jobDescription() const override;
0039         QString jobDetails() const override;
0040 
0041     public Q_SLOTS:
0042         void cancel() override;
0043         void start() override;
0044 
0045         /**
0046          * Used to specify a non-default writer.
0047          * If this does notget called DataJob determines
0048          * the writer itself.
0049          */
0050         void setWriterJob( AbstractWriter* );
0051         void setImager( IsoImager* );
0052 
0053     protected Q_SLOTS:
0054         void slotIsoImagerFinished( bool success );
0055         void slotIsoImagerPercent(int);
0056         void slotWriterJobPercent( int p );
0057         void slotWriterNextTrack( int t, int tt );
0058         void slotWriterJobFinished( bool success );
0059         void slotVerificationProgress( int );
0060         void slotVerificationFinished( bool );
0061         void writeImage();
0062 
0063         /**
0064          * \return true if some job was still running and was
0065          * cancelled. Thus, this can be called multiple times
0066          * and also to check if the job can be finished.
0067          */
0068         bool cancelAll();
0069 
0070     private Q_SLOTS:
0071         void slotMultiSessionParamterSetupDone( bool );
0072 
0073     protected:
0074         virtual bool prepareWriterJob();
0075         virtual void prepareImager();
0076         virtual void cleanup();
0077 
0078         DataDoc::MultiSessionMode usedMultiSessionMode() const;
0079 
0080         AbstractWriter* m_writerJob;
0081         IsoImager* m_isoImager;
0082 
0083     private:
0084         bool waitForBurnMedium();
0085         bool startWriterJob();
0086         bool startOnTheFlyWriting();
0087         void prepareWriting();
0088         void connectImager();
0089         bool setupCdrecordJob();
0090         bool setupCdrdaoJob();
0091         bool setupGrowisofsJob();
0092         void startPipe();
0093         void finishCopy();
0094 
0095         class Private;
0096         Private* d;
0097     };
0098 }
0099 
0100 #endif