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

0001 /*
0002     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef K3B_ISO_OPTIONS_H
0007 #define K3B_ISO_OPTIONS_H
0008 
0009 #include "k3b_export.h"
0010 #include <KConfigGroup>
0011 #include <QString>
0012 
0013 
0014 namespace K3b {
0015     class LIBK3B_EXPORT IsoOptions
0016     {
0017     public:
0018         IsoOptions();
0019 
0020         // -- mkisofs-options ----------------------------------------------------------------------
0021         bool createRockRidge() const { return m_createRockRidge; }
0022         bool createJoliet() const { return m_createJoliet; }
0023         bool createUdf() const { return m_createUdf; }
0024         bool ISOallowLowercase() const { return m_ISOallowLowercase || ISOuntranslatedFilenames(); }
0025         bool ISOallowPeriodAtBegin() const { return m_ISOallowPeriodAtBegin || ISOuntranslatedFilenames(); }
0026         bool ISOallow31charFilenames() const { return m_ISOallow31charFilenames || ISOmaxFilenameLength() || ISOuntranslatedFilenames(); }
0027         bool ISOomitVersionNumbers() const { return m_ISOomitVersionNumbers || ISOmaxFilenameLength(); }
0028         bool ISOomitTrailingPeriod() const { return m_ISOomitTrailingPeriod || ISOuntranslatedFilenames(); }
0029         bool ISOmaxFilenameLength() const { return m_ISOmaxFilenameLength || ISOuntranslatedFilenames(); }
0030         bool ISOrelaxedFilenames() const { return m_ISOrelaxedFilenames || ISOuntranslatedFilenames(); }
0031         bool ISOnoIsoTranslate() const { return m_ISOnoIsoTranslate; }
0032         bool ISOallowMultiDot() const { return m_ISOallowMultiDot || ISOuntranslatedFilenames(); }
0033         bool ISOuntranslatedFilenames() const { return m_ISOuntranslatedFilenames; }
0034         bool followSymbolicLinks() const { return m_followSymbolicLinks; }
0035         bool createTRANS_TBL() const { return m_createTRANS_TBL; }
0036         bool hideTRANS_TBL() const { return m_hideTRANS_TBL; }
0037         bool jolietLong() const { return m_jolietLong; }
0038 
0039         bool preserveFilePermissions() const { return m_preserveFilePermissions; }
0040 
0041         int ISOLevel() const { return m_isoLevel; }
0042         const QString& systemId() const { return m_systemId; }
0043         const QString& applicationID() const { return m_applicationID; }
0044         const QString& volumeID() const;
0045         const QString& volumeSetId() const { return m_volumeSetId; }
0046         int volumeSetSize() const { return m_volumeSetSize; }
0047         int volumeSetNumber() const { return m_volumeSetNumber; }
0048         const QString& publisher() const { return m_publisher; }
0049         const QString& preparer() const { return m_preparer; }
0050         const QString& abstractFile() const { return m_abstractFile; }
0051         const QString& copyrightFile() const { return m_copyrightFile; }
0052         const QString& bibliographFile() const { return m_bibliographFile; }
0053 
0054         void setCreateRockRidge( bool b ) { m_createRockRidge = b; }
0055         void setCreateJoliet( bool b ) {  m_createJoliet = b; }
0056         void setCreateUdf( bool b ) { m_createUdf = b; }
0057         void setISOallowLowercase( bool b ) {  m_ISOallowLowercase = b; }
0058         void setISOallowPeriodAtBegin( bool b ) {  m_ISOallowPeriodAtBegin = b; }
0059         void setISOallow31charFilenames( bool b ) {  m_ISOallow31charFilenames = b; }
0060         void setISOomitVersionNumbers( bool b ) {  m_ISOomitVersionNumbers = b; }
0061         void setISOomitTrailingPeriod( bool b ) {  m_ISOomitTrailingPeriod = b; }
0062         void setISOmaxFilenameLength( bool b ) {  m_ISOmaxFilenameLength = b; }
0063         void setISOrelaxedFilenames( bool b ) {  m_ISOrelaxedFilenames = b; }
0064         void setISOnoIsoTranslate( bool b ) {  m_ISOnoIsoTranslate = b; }
0065         void setISOallowMultiDot( bool b ) {  m_ISOallowMultiDot = b; }
0066         void setISOuntranslatedFilenames( bool b ) {  m_ISOuntranslatedFilenames = b; }
0067         void setFollowSymbolicLinks( bool b ) {  m_followSymbolicLinks = b; }
0068         void setCreateTRANS_TBL( bool b ) {  m_createTRANS_TBL = b; }
0069         void setHideTRANS_TBL( bool b ) {  m_hideTRANS_TBL = b; }
0070         void setJolietLong( bool b ) { m_jolietLong = b; }
0071 
0072         void setISOLevel( int i ) { m_isoLevel = i; }
0073         void setSystemId( const QString& s ) { m_systemId = s; }
0074         void setApplicationID( const QString& s ) { m_applicationID = s; }
0075 
0076         /**
0077          * Set the filesystems volume id.
0078          *
0079          * max length for this field is 32 chars.
0080          */
0081         void setVolumeID( const QString& s ) { m_volumeIDSet = true; m_volumeID = s; }
0082         void setVolumeSetId( const QString& s ) { m_volumeSetId = s; }
0083         void setVolumeSetSize( int size ) { m_volumeSetSize = size; }
0084         void setVolumeSetNumber( int n ) { m_volumeSetNumber = n; }
0085         void setPublisher( const QString& s ) { m_publisher = s; }
0086         void setPreparer( const QString& s ) { m_preparer = s; }
0087         void setAbstractFile( const QString& s ) { m_abstractFile = s; }
0088         void setCoprightFile( const QString& s ) { m_copyrightFile = s; }
0089         void setBibliographFile( const QString& s ) { m_bibliographFile = s; }
0090 
0091         void setPreserveFilePermissions( bool b ) { m_preserveFilePermissions = b; }
0092         // ----------------------------------------------------------------- mkisofs-options -----------
0093 
0094         enum whiteSpaceTreatments { noChange = 0, replace = 1, strip = 2, extended = 3 };
0095 
0096         void setWhiteSpaceTreatment( int i ) { m_whiteSpaceTreatment = i; }
0097         int whiteSpaceTreatment() const { return m_whiteSpaceTreatment; }
0098         const QString& whiteSpaceTreatmentReplaceString() const { return m_whiteSpaceTreatmentReplaceString; }
0099         void setWhiteSpaceTreatmentReplaceString( const QString& s ) { m_whiteSpaceTreatmentReplaceString = s; }
0100 
0101         bool discardSymlinks() const { return m_discardSymlinks; }
0102         void setDiscardSymlinks( bool b ) { m_discardSymlinks = b; }
0103 
0104         bool discardBrokenSymlinks() const { return m_discardBrokenSymlinks; }
0105         void setDiscardBrokenSymlinks( bool b ) { m_discardBrokenSymlinks = b; }
0106 
0107         bool doNotCacheInodes() const { return m_doNotCacheInodes; }
0108         void setDoNotCacheInodes( bool b ) { m_doNotCacheInodes = b; }
0109 
0110         bool doNotImportSession() const { return m_doNotImportSession; }
0111         void setDoNotImportSession( bool b ) { m_doNotImportSession = b; }
0112 
0113         void save( KConfigGroup c, bool saveVolumeDesc = true );
0114 
0115         static IsoOptions load( const KConfigGroup& c, bool loadVolumeDesc = true );
0116         static IsoOptions defaults();
0117 
0118     private:
0119         // volume descriptor
0120         mutable bool m_defaultVolumeIDSet;
0121         mutable QString m_defaultVolumeID;
0122         bool m_volumeIDSet;
0123         QString m_volumeID;
0124         QString m_applicationID;
0125         QString m_preparer;
0126         QString m_publisher;
0127         QString m_systemId;
0128         QString m_volumeSetId;
0129         QString m_abstractFile;
0130         QString m_copyrightFile;
0131         QString m_bibliographFile;
0132 
0133         int m_volumeSetSize;
0134         int m_volumeSetNumber;
0135 
0136         bool m_bForceInputCharset;
0137         QString m_inputCharset;
0138 
0139         // mkisofs options -------------------------------------
0140         bool m_createRockRidge;    // -r or -R
0141         bool m_createJoliet;             // -J
0142         bool m_createUdf;                // -udf
0143         bool m_ISOallowLowercase;   // -allow-lowercase
0144         bool m_ISOallowPeriodAtBegin;   // -L
0145         bool m_ISOallow31charFilenames;  // -I
0146         bool m_ISOomitVersionNumbers;   // -N
0147         bool m_ISOomitTrailingPeriod;   // -d
0148         bool m_ISOmaxFilenameLength;     // -max-iso9660-filenames (forces -N)
0149         bool m_ISOrelaxedFilenames;      // -relaxed-filenames
0150         bool m_ISOnoIsoTranslate;        // -no-iso-translate
0151         bool m_ISOallowMultiDot;          // -allow-multidot
0152         bool m_ISOuntranslatedFilenames;   // -U (forces -d, -I, -L, -N, -relaxed-filenames, -allow-lowercase, -allow-multidot, -no-iso-translate)
0153         bool m_followSymbolicLinks;       // -f
0154         bool m_createTRANS_TBL;    // -T
0155         bool m_hideTRANS_TBL;    // -hide-joliet-trans-tbl
0156 
0157         bool m_preserveFilePermissions;   // if true -R instead of -r is used
0158         bool m_jolietLong;
0159 
0160         bool m_doNotCacheInodes;
0161         bool m_doNotImportSession;
0162 
0163         int m_isoLevel;
0164 
0165 
0166         int m_whiteSpaceTreatment;
0167         QString m_whiteSpaceTreatmentReplaceString;
0168 
0169         bool m_discardSymlinks;
0170         bool m_discardBrokenSymlinks;
0171     };
0172 }
0173 
0174 #endif