1 /*
2     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #ifndef K3B_ISO_OPTIONS_H
7 #define K3B_ISO_OPTIONS_H
8 
9 #include "k3b_export.h"
10 #include <KConfigGroup>
11 #include <QString>
12 
13 
14 namespace K3b {
15     class LIBK3B_EXPORT IsoOptions
16     {
17     public:
18         IsoOptions();
19 
20         // -- mkisofs-options ----------------------------------------------------------------------
createRockRidge()21         bool createRockRidge() const { return m_createRockRidge; }
createJoliet()22         bool createJoliet() const { return m_createJoliet; }
createUdf()23         bool createUdf() const { return m_createUdf; }
ISOallowLowercase()24         bool ISOallowLowercase() const { return m_ISOallowLowercase || ISOuntranslatedFilenames(); }
ISOallowPeriodAtBegin()25         bool ISOallowPeriodAtBegin() const { return m_ISOallowPeriodAtBegin || ISOuntranslatedFilenames(); }
ISOallow31charFilenames()26         bool ISOallow31charFilenames() const { return m_ISOallow31charFilenames || ISOmaxFilenameLength() || ISOuntranslatedFilenames(); }
ISOomitVersionNumbers()27         bool ISOomitVersionNumbers() const { return m_ISOomitVersionNumbers || ISOmaxFilenameLength(); }
ISOomitTrailingPeriod()28         bool ISOomitTrailingPeriod() const { return m_ISOomitTrailingPeriod || ISOuntranslatedFilenames(); }
ISOmaxFilenameLength()29         bool ISOmaxFilenameLength() const { return m_ISOmaxFilenameLength || ISOuntranslatedFilenames(); }
ISOrelaxedFilenames()30         bool ISOrelaxedFilenames() const { return m_ISOrelaxedFilenames || ISOuntranslatedFilenames(); }
ISOnoIsoTranslate()31         bool ISOnoIsoTranslate() const { return m_ISOnoIsoTranslate; }
ISOallowMultiDot()32         bool ISOallowMultiDot() const { return m_ISOallowMultiDot || ISOuntranslatedFilenames(); }
ISOuntranslatedFilenames()33         bool ISOuntranslatedFilenames() const { return m_ISOuntranslatedFilenames; }
followSymbolicLinks()34         bool followSymbolicLinks() const { return m_followSymbolicLinks; }
createTRANS_TBL()35         bool createTRANS_TBL() const { return m_createTRANS_TBL; }
hideTRANS_TBL()36         bool hideTRANS_TBL() const { return m_hideTRANS_TBL; }
jolietLong()37         bool jolietLong() const { return m_jolietLong; }
38 
preserveFilePermissions()39         bool preserveFilePermissions() const { return m_preserveFilePermissions; }
40 
ISOLevel()41         int ISOLevel() const { return m_isoLevel; }
systemId()42         const QString& systemId() const { return m_systemId; }
applicationID()43         const QString& applicationID() const { return m_applicationID; }
44         const QString& volumeID() const;
volumeSetId()45         const QString& volumeSetId() const { return m_volumeSetId; }
volumeSetSize()46         int volumeSetSize() const { return m_volumeSetSize; }
volumeSetNumber()47         int volumeSetNumber() const { return m_volumeSetNumber; }
publisher()48         const QString& publisher() const { return m_publisher; }
preparer()49         const QString& preparer() const { return m_preparer; }
abstractFile()50         const QString& abstractFile() const { return m_abstractFile; }
copyrightFile()51         const QString& copyrightFile() const { return m_copyrightFile; }
bibliographFile()52         const QString& bibliographFile() const { return m_bibliographFile; }
53 
setCreateRockRidge(bool b)54         void setCreateRockRidge( bool b ) { m_createRockRidge = b; }
setCreateJoliet(bool b)55         void setCreateJoliet( bool b ) {  m_createJoliet = b; }
setCreateUdf(bool b)56         void setCreateUdf( bool b ) { m_createUdf = b; }
setISOallowLowercase(bool b)57         void setISOallowLowercase( bool b ) {  m_ISOallowLowercase = b; }
setISOallowPeriodAtBegin(bool b)58         void setISOallowPeriodAtBegin( bool b ) {  m_ISOallowPeriodAtBegin = b; }
setISOallow31charFilenames(bool b)59         void setISOallow31charFilenames( bool b ) {  m_ISOallow31charFilenames = b; }
setISOomitVersionNumbers(bool b)60         void setISOomitVersionNumbers( bool b ) {  m_ISOomitVersionNumbers = b; }
setISOomitTrailingPeriod(bool b)61         void setISOomitTrailingPeriod( bool b ) {  m_ISOomitTrailingPeriod = b; }
setISOmaxFilenameLength(bool b)62         void setISOmaxFilenameLength( bool b ) {  m_ISOmaxFilenameLength = b; }
setISOrelaxedFilenames(bool b)63         void setISOrelaxedFilenames( bool b ) {  m_ISOrelaxedFilenames = b; }
setISOnoIsoTranslate(bool b)64         void setISOnoIsoTranslate( bool b ) {  m_ISOnoIsoTranslate = b; }
setISOallowMultiDot(bool b)65         void setISOallowMultiDot( bool b ) {  m_ISOallowMultiDot = b; }
setISOuntranslatedFilenames(bool b)66         void setISOuntranslatedFilenames( bool b ) {  m_ISOuntranslatedFilenames = b; }
setFollowSymbolicLinks(bool b)67         void setFollowSymbolicLinks( bool b ) {  m_followSymbolicLinks = b; }
setCreateTRANS_TBL(bool b)68         void setCreateTRANS_TBL( bool b ) {  m_createTRANS_TBL = b; }
setHideTRANS_TBL(bool b)69         void setHideTRANS_TBL( bool b ) {  m_hideTRANS_TBL = b; }
setJolietLong(bool b)70         void setJolietLong( bool b ) { m_jolietLong = b; }
71 
setISOLevel(int i)72         void setISOLevel( int i ) { m_isoLevel = i; }
setSystemId(const QString & s)73         void setSystemId( const QString& s ) { m_systemId = s; }
setApplicationID(const QString & s)74         void setApplicationID( const QString& s ) { m_applicationID = s; }
75 
76         /**
77          * Set the filesystems volume id.
78          *
79          * max length for this field is 32 chars.
80          */
setVolumeID(const QString & s)81         void setVolumeID( const QString& s ) { m_volumeIDSet = true; m_volumeID = s; }
setVolumeSetId(const QString & s)82         void setVolumeSetId( const QString& s ) { m_volumeSetId = s; }
setVolumeSetSize(int size)83         void setVolumeSetSize( int size ) { m_volumeSetSize = size; }
setVolumeSetNumber(int n)84         void setVolumeSetNumber( int n ) { m_volumeSetNumber = n; }
setPublisher(const QString & s)85         void setPublisher( const QString& s ) { m_publisher = s; }
setPreparer(const QString & s)86         void setPreparer( const QString& s ) { m_preparer = s; }
setAbstractFile(const QString & s)87         void setAbstractFile( const QString& s ) { m_abstractFile = s; }
setCoprightFile(const QString & s)88         void setCoprightFile( const QString& s ) { m_copyrightFile = s; }
setBibliographFile(const QString & s)89         void setBibliographFile( const QString& s ) { m_bibliographFile = s; }
90 
setPreserveFilePermissions(bool b)91         void setPreserveFilePermissions( bool b ) { m_preserveFilePermissions = b; }
92         // ----------------------------------------------------------------- mkisofs-options -----------
93 
94         enum whiteSpaceTreatments { noChange = 0, replace = 1, strip = 2, extended = 3 };
95 
setWhiteSpaceTreatment(int i)96         void setWhiteSpaceTreatment( int i ) { m_whiteSpaceTreatment = i; }
whiteSpaceTreatment()97         int whiteSpaceTreatment() const { return m_whiteSpaceTreatment; }
whiteSpaceTreatmentReplaceString()98         const QString& whiteSpaceTreatmentReplaceString() const { return m_whiteSpaceTreatmentReplaceString; }
setWhiteSpaceTreatmentReplaceString(const QString & s)99         void setWhiteSpaceTreatmentReplaceString( const QString& s ) { m_whiteSpaceTreatmentReplaceString = s; }
100 
discardSymlinks()101         bool discardSymlinks() const { return m_discardSymlinks; }
setDiscardSymlinks(bool b)102         void setDiscardSymlinks( bool b ) { m_discardSymlinks = b; }
103 
discardBrokenSymlinks()104         bool discardBrokenSymlinks() const { return m_discardBrokenSymlinks; }
setDiscardBrokenSymlinks(bool b)105         void setDiscardBrokenSymlinks( bool b ) { m_discardBrokenSymlinks = b; }
106 
doNotCacheInodes()107         bool doNotCacheInodes() const { return m_doNotCacheInodes; }
setDoNotCacheInodes(bool b)108         void setDoNotCacheInodes( bool b ) { m_doNotCacheInodes = b; }
109 
doNotImportSession()110         bool doNotImportSession() const { return m_doNotImportSession; }
setDoNotImportSession(bool b)111         void setDoNotImportSession( bool b ) { m_doNotImportSession = b; }
112 
113         void save( KConfigGroup c, bool saveVolumeDesc = true );
114 
115         static IsoOptions load( const KConfigGroup& c, bool loadVolumeDesc = true );
116         static IsoOptions defaults();
117 
118     private:
119         // volume descriptor
120         mutable bool m_defaultVolumeIDSet;
121         mutable QString m_defaultVolumeID;
122         bool m_volumeIDSet;
123         QString m_volumeID;
124         QString m_applicationID;
125         QString m_preparer;
126         QString m_publisher;
127         QString m_systemId;
128         QString m_volumeSetId;
129         QString m_abstractFile;
130         QString m_copyrightFile;
131         QString m_bibliographFile;
132 
133         int m_volumeSetSize;
134         int m_volumeSetNumber;
135 
136         bool m_bForceInputCharset;
137         QString m_inputCharset;
138 
139         // mkisofs options -------------------------------------
140         bool m_createRockRidge;    // -r or -R
141         bool m_createJoliet;             // -J
142         bool m_createUdf;                // -udf
143         bool m_ISOallowLowercase;   // -allow-lowercase
144         bool m_ISOallowPeriodAtBegin;   // -L
145         bool m_ISOallow31charFilenames;  // -I
146         bool m_ISOomitVersionNumbers;   // -N
147         bool m_ISOomitTrailingPeriod;   // -d
148         bool m_ISOmaxFilenameLength;     // -max-iso9660-filenames (forces -N)
149         bool m_ISOrelaxedFilenames;      // -relaxed-filenames
150         bool m_ISOnoIsoTranslate;        // -no-iso-translate
151         bool m_ISOallowMultiDot;          // -allow-multidot
152         bool m_ISOuntranslatedFilenames;   // -U (forces -d, -I, -L, -N, -relaxed-filenames, -allow-lowercase, -allow-multidot, -no-iso-translate)
153         bool m_followSymbolicLinks;       // -f
154         bool m_createTRANS_TBL;    // -T
155         bool m_hideTRANS_TBL;    // -hide-joliet-trans-tbl
156 
157         bool m_preserveFilePermissions;   // if true -R instead of -r is used
158         bool m_jolietLong;
159 
160         bool m_doNotCacheInodes;
161         bool m_doNotImportSession;
162 
163         int m_isoLevel;
164 
165 
166         int m_whiteSpaceTreatment;
167         QString m_whiteSpaceTreatmentReplaceString;
168 
169         bool m_discardSymlinks;
170         bool m_discardBrokenSymlinks;
171     };
172 }
173 
174 #endif
175