| 1 | /* Copyright (C) 2017 Dan Chapman <[email protected]> |
| 2 | |
| 3 | This file is part of Dekko email client for Ubuntu devices |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU General Public License as |
| 7 | published by the Free Software Foundation; either version 2 of |
| 8 | the License or (at your option) version 3 |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | #include "MazOptions.h" |
| 19 | #include <leveldb/options.h> |
| 20 | |
| 21 | MazOptions::MazOptions(QObject *parent) : QObject(parent), |
| 22 | m_createIfMissing(true), m_errorIfExists(false), m_paranoidChecks(false), |
| 23 | m_compressionType(CompressionType::SnappyCompression) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | bool MazOptions::createIfMissing() const |
| 28 | { |
| 29 | return m_createIfMissing; |
| 30 | } |
| 31 | |
| 32 | bool MazOptions::errorIfExists() const |
| 33 | { |
| 34 | return m_errorIfExists; |
| 35 | } |
| 36 | |
| 37 | bool MazOptions::paranoidChecks() const |
| 38 | { |
| 39 | return m_paranoidChecks; |
| 40 | } |
| 41 | |
| 42 | MazOptions::CompressionType MazOptions::compressionType() const |
| 43 | { |
| 44 | return m_compressionType; |
| 45 | } |
| 46 | |
| 47 | void MazOptions::setCreateIfMissing(const bool value) |
| 48 | { |
| 49 | if (value != m_createIfMissing) { |
| 50 | m_createIfMissing = value; |
| 51 | emit optionChanged(); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | void MazOptions::setErrorIfExists(const bool value) |
| 56 | { |
| 57 | if (value != m_errorIfExists) { |
| 58 | m_errorIfExists = value; |
| 59 | emit optionChanged(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | void MazOptions::setParanoidChecks(const bool value) |
| 64 | { |
| 65 | if (value != m_paranoidChecks) { |
| 66 | m_paranoidChecks = value; |
| 67 | emit optionChanged(); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | void MazOptions::setCompressionType(const MazOptions::CompressionType type) |
| 72 | { |
| 73 | if (type != m_compressionType) { |
| 74 | m_compressionType = type; |
| 75 | emit optionChanged(); |
| 76 | } |
| 77 | } |
| 78 |