File indexing completed on 2024-05-05 05:50:41
0001 /* 0002 SPDX-FileCopyrightText: 2016 Elvis Angelaccio <elvis.angelaccio@kde.org> 0003 0004 SPDX-License-Identifier: BSD-2-Clause 0005 */ 0006 0007 #include "options.h" 0008 0009 namespace Kerfuffle 0010 { 0011 bool Options::encryptedArchiveHint() const 0012 { 0013 return m_encryptedArchiveHint; 0014 } 0015 0016 void Options::setEncryptedArchiveHint(bool encrypted) 0017 { 0018 m_encryptedArchiveHint = encrypted; 0019 } 0020 0021 bool ExtractionOptions::preservePaths() const 0022 { 0023 return m_preservePaths; 0024 } 0025 0026 void ExtractionOptions::setPreservePaths(bool preservePaths) 0027 { 0028 m_preservePaths = preservePaths; 0029 } 0030 0031 bool ExtractionOptions::isDragAndDropEnabled() const 0032 { 0033 return m_dragAndDrop; 0034 } 0035 0036 void ExtractionOptions::setDragAndDropEnabled(bool enabled) 0037 { 0038 m_dragAndDrop = enabled; 0039 } 0040 0041 bool ExtractionOptions::alwaysUseTempDir() const 0042 { 0043 return m_alwaysUseTempDir; 0044 } 0045 0046 void ExtractionOptions::setAlwaysUseTempDir(bool alwaysUseTempDir) 0047 { 0048 m_alwaysUseTempDir = alwaysUseTempDir; 0049 } 0050 0051 bool CompressionOptions::isCompressionLevelSet() const 0052 { 0053 return compressionLevel() != -1; 0054 } 0055 0056 bool CompressionOptions::isVolumeSizeSet() const 0057 { 0058 return volumeSize() > 0; 0059 } 0060 0061 int CompressionOptions::compressionLevel() const 0062 { 0063 return m_compressionLevel; 0064 } 0065 0066 void CompressionOptions::setCompressionLevel(int level) 0067 { 0068 m_compressionLevel = level; 0069 } 0070 0071 ulong CompressionOptions::volumeSize() const 0072 { 0073 return m_volumeSize; 0074 } 0075 0076 void CompressionOptions::setVolumeSize(ulong size) 0077 { 0078 m_volumeSize = size; 0079 } 0080 0081 QString CompressionOptions::compressionMethod() const 0082 { 0083 return m_compressionMethod; 0084 } 0085 0086 void CompressionOptions::setCompressionMethod(const QString &method) 0087 { 0088 m_compressionMethod = method; 0089 } 0090 0091 QString CompressionOptions::encryptionMethod() const 0092 { 0093 return m_encryptionMethod; 0094 } 0095 0096 void CompressionOptions::setEncryptionMethod(const QString &method) 0097 { 0098 m_encryptionMethod = method; 0099 } 0100 0101 QString CompressionOptions::globalWorkDir() const 0102 { 0103 return m_globalWorkDir; 0104 } 0105 0106 void CompressionOptions::setGlobalWorkDir(const QString &workDir) 0107 { 0108 m_globalWorkDir = workDir; 0109 } 0110 0111 QDebug operator<<(QDebug d, const CompressionOptions &options) 0112 { 0113 d.nospace() << "(encryption hint: " << options.encryptedArchiveHint(); 0114 if (!options.compressionMethod().isEmpty()) { 0115 d.nospace() << ", compression method: " << options.compressionMethod(); 0116 } 0117 if (!options.encryptionMethod().isEmpty()) { 0118 d.nospace() << ", encryption method: " << options.encryptionMethod(); 0119 } 0120 if (!options.globalWorkDir().isEmpty()) { 0121 d.nospace() << ", global work dir: " << options.globalWorkDir(); 0122 } 0123 d.nospace() << ", compression level: " << options.compressionLevel(); 0124 d.nospace() << ", volume size: " << options.volumeSize(); 0125 d.nospace() << ")"; 0126 return d.space(); 0127 } 0128 0129 QDebug operator<<(QDebug d, ExtractionOptions options) 0130 { 0131 d.nospace() << "(encryption hint: " << options.encryptedArchiveHint(); 0132 d.nospace() << ", preserve paths: " << options.preservePaths(); 0133 d.nospace() << ", drag and drop: " << options.isDragAndDropEnabled(); 0134 d.nospace() << ", always temp dir: " << options.alwaysUseTempDir(); 0135 d.nospace() << ")"; 0136 return d.space(); 0137 } 0138 0139 }