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

0001 /*
0002     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 
0007 #include "k3bvideodvddoc.h"
0008 #include "k3bvideodvdjob.h"
0009 #include "k3bdiritem.h"
0010 #include "k3bisooptions.h"
0011 
0012 #include <KConfig>
0013 
0014 
0015 K3b::VideoDvdDoc::VideoDvdDoc( QObject* parent )
0016   : K3b::DataDoc( parent )
0017 {
0018 }
0019 
0020 
0021 K3b::VideoDvdDoc::~VideoDvdDoc()
0022 {
0023 }
0024 
0025 
0026 bool K3b::VideoDvdDoc::newDocument()
0027 {
0028   if( K3b::DataDoc::newDocument() ) {
0029 
0030     // K3b::DataDoc::newDocument already deleted m_videoTsDir (again: bad design!)
0031     addAudioVideoTsDirs();
0032 
0033     setMultiSessionMode( NONE );
0034 
0035     setModified( false );
0036 
0037     return true;
0038   }
0039   else
0040     return false;
0041 }
0042 
0043 void K3b::VideoDvdDoc::clear()
0044 {
0045     bool addTsDirs = false;
0046     if (m_videoTsDir) {
0047         // K3b::DataDoc::clear() needs the items to be removeable or clear loops forever
0048         // so change them to removeable if they exist, so they can be deleted and add them back again later
0049         m_videoTsDir->setRemoveable(true);
0050         m_audioTsDir->setRemoveable(true);
0051         addTsDirs = true;
0052     }
0053     K3b::DataDoc::clear();
0054     if (addTsDirs) {
0055         addAudioVideoTsDirs();
0056     }
0057 }
0058 
0059 void K3b::VideoDvdDoc::addAudioVideoTsDirs()
0060 {
0061     m_videoTsDir = new K3b::DirItem( "VIDEO_TS" );
0062     m_videoTsDir->setRemoveable(false);
0063     m_videoTsDir->setRenameable(false);
0064     m_videoTsDir->setMoveable(false);
0065     m_videoTsDir->setHideable(false);
0066     root()->addDataItem( m_videoTsDir );
0067 
0068     m_audioTsDir = new K3b::DirItem( "AUDIO_TS" );
0069     m_audioTsDir->setRemoveable(false);
0070     m_audioTsDir->setRenameable(false);
0071     m_audioTsDir->setMoveable(false);
0072     m_audioTsDir->setHideable(false);
0073     root()->addDataItem( m_audioTsDir );
0074 }
0075 
0076 
0077 K3b::BurnJob* K3b::VideoDvdDoc::newBurnJob( K3b::JobHandler* hdl, QObject* parent )
0078 {
0079   return new K3b::VideoDvdJob( this, hdl, parent );
0080 }
0081 
0082 
0083 K3b::Device::MediaTypes K3b::VideoDvdDoc::supportedMediaTypes() const
0084 {
0085     return K3b::Device::MEDIA_WRITABLE_DVD | K3b::Device::MEDIA_WRITABLE_BD;
0086 }
0087 
0088 bool K3b::VideoDvdDoc::saveDocumentData(QDomElement*)
0089 {
0090     qDebug() << "DEBUG:" << __PRETTY_FUNCTION__;
0091     return true;
0092 }
0093 
0094 //#include "k3bdvddoc.moc"