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

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef _K3B_DVD_BOOKTYPE_JOB_H_
0006 #define _K3B_DVD_BOOKTYPE_JOB_H_
0007 
0008 
0009 #include "k3bjob.h"
0010 #include <QProcess>
0011 
0012 
0013 namespace K3b {
0014     namespace Device {
0015         class Device;
0016         class DeviceHandler;
0017     }
0018 
0019 
0020     /**
0021      * This job can change the compatibility bit of DVD+R(W) media
0022      * with supported dvd writers.
0023      */
0024     class DvdBooktypeJob : public Job
0025     {
0026         Q_OBJECT
0027 
0028     public:
0029         explicit DvdBooktypeJob( JobHandler*, QObject* parent = 0 );
0030         ~DvdBooktypeJob() override;
0031 
0032         QString jobDescription() const override;
0033         QString jobDetails() const override;
0034 
0035         /**
0036          * @list SET_MEDIA_DVD_ROM Change media identification on current media to DVD-ROM.
0037          * @list SET_MEDIA_DVD_R_W Change media identification on current media to DVD+R or DVD+RW.
0038          * @list SET_UNIT_DVD_ROM_ON_NEW_DVD_R Set the drive to write DVD-ROM specification on future written DVD+R discs.
0039          * @list SET_UNIT_DVD_ROM_ON_NEW_DVD_RW Set the drive to write DVD-ROM specification on future written DVD+RW discs.
0040          * @list SET_UNIT_DVD_R_ON_NEW_DVD_R Set the drive to write DVD+R specification on future written DVD+R discs.
0041          * @list SET_UNIT_DVD_RW_ON_NEW_DVD_RW Set the drive to write DVD+RW specification on future written DVD+RW discs.
0042          */
0043         enum Action {
0044             SET_MEDIA_DVD_ROM,
0045             SET_MEDIA_DVD_R_W,
0046             SET_UNIT_DVD_ROM_ON_NEW_DVD_R,
0047             SET_UNIT_DVD_ROM_ON_NEW_DVD_RW,
0048             SET_UNIT_DVD_R_ON_NEW_DVD_R,
0049             SET_UNIT_DVD_RW_ON_NEW_DVD_RW
0050         };
0051 
0052     public Q_SLOTS:
0053         void start() override;
0054 
0055         /**
0056          * The devicehandler needs to have a valid NgDiskInfo
0057          * Use this to prevent the job from searching a media.
0058          */
0059         void start( K3b::Device::DeviceHandler* );
0060 
0061         void cancel() override;
0062 
0063         void setDevice( K3b::Device::Device* );
0064 
0065         void setAction( int a ) { m_action = a; }
0066 
0067         /**
0068          * If set true the job ignores the global K3b setting
0069          * and does not eject the CD-RW after finishing
0070          */
0071         void setForceNoEject( bool );
0072 
0073     private Q_SLOTS:
0074         void slotStderrLine( const QString& );
0075         void slotProcessFinished( int, QProcess::ExitStatus );
0076         void slotDeviceHandlerFinished( Device::DeviceHandler* );
0077         void slotEjectingFinished( Device::DeviceHandler* );
0078 
0079     private:
0080         void startBooktypeChange();
0081 
0082         int m_action;
0083 
0084         class Private;
0085         Private* d;
0086     };
0087 }
0088 
0089 
0090 #endif