File indexing completed on 2023-12-03 08:29:44
0001 /* 0002 SPDX-FileCopyrightText: 2021-2023 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libruqolacore_export.h" 0010 #include <QDebug> 0011 #include <QJsonObject> 0012 class LIBRUQOLACORE_EXPORT RetentionInfo 0013 { 0014 public: 0015 RetentionInfo(); 0016 ~RetentionInfo() = default; 0017 void parseRetentionInfo(const QJsonObject &replyObject); 0018 0019 [[nodiscard]] bool enabled() const; 0020 void setEnabled(bool enabled); 0021 0022 [[nodiscard]] bool overrideGlobal() const; 0023 void setOverrideGlobal(bool overrideGlobal); 0024 0025 [[nodiscard]] bool excludePinned() const; 0026 void setExcludePinned(bool excludePinned); 0027 0028 [[nodiscard]] bool filesOnly() const; 0029 void setFilesOnly(bool filesOnly); 0030 0031 [[nodiscard]] int maxAge() const; 0032 void setMaxAge(int maxAge); 0033 [[nodiscard]] bool operator==(RetentionInfo other) const; 0034 [[nodiscard]] bool operator!=(RetentionInfo other) const; 0035 0036 [[nodiscard]] static QJsonObject serialize(RetentionInfo retention); 0037 [[nodiscard]] static RetentionInfo deserialize(const QJsonObject &o); 0038 [[nodiscard]] bool isNotDefault() const; 0039 0040 private: 0041 int mMaxAge = -1; 0042 bool mEnabled = false; 0043 bool mOverrideGlobal = false; 0044 bool mExcludePinned = false; 0045 bool mFilesOnly = false; 0046 }; 0047 Q_DECLARE_METATYPE(RetentionInfo) 0048 Q_DECLARE_TYPEINFO(RetentionInfo, Q_MOVABLE_TYPE); 0049 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, RetentionInfo t);