File indexing completed on 2024-04-28 16:11:05

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 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 class LIBRUQOLACORE_EXPORT RetentionInfo
0012 {
0013 public:
0014     RetentionInfo();
0015     ~RetentionInfo() = default;
0016     void parseRetentionInfo(const QJsonObject &replyObject);
0017 
0018     [[nodiscard]] bool enabled() const;
0019     void setEnabled(bool enabled);
0020 
0021     [[nodiscard]] bool overrideGlobal() const;
0022     void setOverrideGlobal(bool overrideGlobal);
0023 
0024     [[nodiscard]] bool excludePinned() const;
0025     void setExcludePinned(bool excludePinned);
0026 
0027     [[nodiscard]] bool filesOnly() const;
0028     void setFilesOnly(bool filesOnly);
0029 
0030     [[nodiscard]] int maxAge() const;
0031     void setMaxAge(int maxAge);
0032     [[nodiscard]] bool operator==(RetentionInfo other) const;
0033     [[nodiscard]] bool operator!=(RetentionInfo other) const;
0034 
0035     [[nodiscard]] static QJsonObject serialize(RetentionInfo retention);
0036     [[nodiscard]] static RetentionInfo deserialize(const QJsonObject &o);
0037     [[nodiscard]] bool isNotDefault() const;
0038 
0039 private:
0040     int mMaxAge = -1;
0041     bool mEnabled = false;
0042     bool mOverrideGlobal = false;
0043     bool mExcludePinned = false;
0044     bool mFilesOnly = false;
0045 };
0046 Q_DECLARE_METATYPE(RetentionInfo)
0047 Q_DECLARE_TYPEINFO(RetentionInfo, Q_MOVABLE_TYPE);
0048 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, RetentionInfo t);