File indexing completed on 2025-03-16 04:29:31
0001 /* 0002 SPDX-FileCopyrightText: 2009 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef _K3B_META_WRITER_H_ 0009 #define _K3B_META_WRITER_H_ 0010 0011 #include "k3babstractwriter.h" 0012 #include "k3b_export.h" 0013 0014 // TODO: - handle media and project size. 0015 // - Use the MetaWriter in all projects 0016 0017 namespace K3b { 0018 /** 0019 * Meta writer which wraps around the cdrecord, cdrdao, and growisofs writers. 0020 * Its main use is to provide one consistent interface and keep all writing mode 0021 * selection and media requesting in one class. 0022 * 0023 * It provides the following features: 0024 * \li select writing app automatically 0025 * \li select writing mode automatically 0026 * \li wait for a medium and emit info messages about what is being written 0027 * \li restrict and modify the supported media types according to the set writing mode 0028 * (Caution: this could lead to failures since the project size if not checked) 0029 */ 0030 class LIBK3B_EXPORT MetaWriter : public AbstractWriter 0031 { 0032 Q_OBJECT 0033 0034 public: 0035 MetaWriter( Device::Device*, JobHandler* hdl, QObject* parent = 0 ); 0036 ~MetaWriter() override; 0037 0038 QIODevice* ioDevice() const override; 0039 0040 /** 0041 * \return The writing app used after starting the job. 0042 */ 0043 K3b::WritingApp usedWritingApp() const; 0044 0045 /** 0046 * \return The writing mode used after starting the job. 0047 */ 0048 K3b::WritingMode usedWritingMode() const; 0049 0050 public Q_SLOTS: 0051 void start() override; 0052 void cancel() override; 0053 0054 /** 0055 * Be aware that the toc that is set here is not necessarily the final toc of the medium. 0056 * It rather represents one session to be written. 0057 */ 0058 void setSessionToWrite( const Device::Toc& toc, const QStringList& images = QStringList() ); 0059 void setSupportedWritingMedia( Device::MediaTypes types ); 0060 void setWritingApp( WritingApp app ); 0061 void setWritingMode( WritingMode mode ); 0062 void setCueFile( const QString& s); 0063 void setClone( bool b ); 0064 void setMultiSession( bool b ); 0065 void setCdText( const Device::CdText& cdtext ); 0066 void setLayerBreak( qint64 lb ); 0067 void setHideFirstTrack( bool b ); 0068 0069 private Q_SLOTS: 0070 void slotWritingJobFinished( bool success ); 0071 0072 private: 0073 bool ensureSettingsIntegrity(); 0074 bool determineUsedAppAndMode(); 0075 bool setupCdrecordJob(); 0076 bool setupCdrskinJob(); 0077 bool setupCdrdaoJob(); 0078 bool setupGrowisofsob(); 0079 bool startTrackWriting(); 0080 0081 void informUser(); 0082 0083 class Private; 0084 Private* const d; 0085 }; 0086 } 0087 0088 #endif