2022-02-22 08:02:34 +00:00
|
|
|
#pragma once
|
2022-02-16 21:51:04 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
namespace Shared::Models
|
|
|
|
{
|
|
|
|
enum SectionType
|
|
|
|
{
|
2022-02-21 17:07:16 +00:00
|
|
|
Unkown = -1,
|
|
|
|
Chat,
|
2022-02-16 21:51:04 +00:00
|
|
|
Community,
|
|
|
|
Wallet,
|
|
|
|
Browser,
|
|
|
|
ProfileSettings,
|
|
|
|
NodeManagement
|
|
|
|
};
|
2022-02-22 08:02:34 +00:00
|
|
|
|
2022-02-21 18:03:38 +00:00
|
|
|
class SectionItem : public QObject
|
2022-02-16 21:51:04 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString id READ getId)
|
2022-02-22 08:02:34 +00:00
|
|
|
Q_PROPERTY(int sectionType READ getSectionType) // FIXME: use enum instead of int
|
2022-02-16 21:51:04 +00:00
|
|
|
Q_PROPERTY(QString name READ getName)
|
|
|
|
Q_PROPERTY(bool amISectionAdmin READ getAmISectionAdmin)
|
|
|
|
Q_PROPERTY(QString description READ getDescription)
|
|
|
|
Q_PROPERTY(QString image READ getImage)
|
|
|
|
Q_PROPERTY(QString icon READ getIcon)
|
|
|
|
Q_PROPERTY(QString color READ getColor)
|
|
|
|
Q_PROPERTY(bool hasNotification READ getHasNotification)
|
|
|
|
Q_PROPERTY(int notificationsCount READ getNotificationsCount)
|
|
|
|
Q_PROPERTY(bool active READ getIsActive NOTIFY activeChanged)
|
|
|
|
Q_PROPERTY(bool enabled READ getIsEnabled)
|
|
|
|
Q_PROPERTY(bool joined READ getHasJoined)
|
|
|
|
Q_PROPERTY(bool isMember READ getIsMember)
|
|
|
|
Q_PROPERTY(bool canJoin READ getCanJoin)
|
|
|
|
Q_PROPERTY(bool canManageUsers READ getCanManageUsers)
|
|
|
|
Q_PROPERTY(bool canRequestAccess READ getCanRequestAccess)
|
|
|
|
Q_PROPERTY(int access READ getAccess)
|
|
|
|
Q_PROPERTY(bool ensOnly READ getIsEnsOnly)
|
|
|
|
|
|
|
|
public:
|
2022-02-22 08:02:34 +00:00
|
|
|
// FIXME: very long constructor, consider only list of necessary parameters (id, parent)?
|
|
|
|
// others could be altered by setters
|
|
|
|
// FIXME: Qt's convention is to put parent at the end of parameters list
|
2022-02-21 17:07:16 +00:00
|
|
|
SectionItem(QObject* parent = nullptr,
|
|
|
|
const QString& id = "",
|
|
|
|
SectionType sectionType = SectionType::Unkown,
|
|
|
|
const QString& name = "",
|
|
|
|
const QString& description = "",
|
|
|
|
const QString& image = "",
|
|
|
|
const QString& icon = "",
|
|
|
|
const QString& color = "",
|
2022-02-16 21:51:04 +00:00
|
|
|
bool active = false,
|
2022-02-21 17:07:16 +00:00
|
|
|
bool enabled = false,
|
2022-02-16 21:51:04 +00:00
|
|
|
bool amISectionAdmin = false,
|
|
|
|
bool hasNotification = false,
|
|
|
|
int notificationsCount = 0,
|
2022-02-21 18:03:38 +00:00
|
|
|
bool isMember = false,
|
2022-02-16 21:51:04 +00:00
|
|
|
bool joined = false,
|
|
|
|
bool canJoin = false,
|
|
|
|
bool canManageUsers = false,
|
|
|
|
bool canRequestAccess = false,
|
|
|
|
int access = 0,
|
2022-02-21 17:07:16 +00:00
|
|
|
bool ensOnly = false);
|
2022-02-16 21:51:04 +00:00
|
|
|
~SectionItem() = default;
|
|
|
|
|
|
|
|
// Getters
|
|
|
|
SectionType getSectionType() const;
|
|
|
|
const QString& getId() const;
|
|
|
|
const QString& getName() const;
|
|
|
|
bool getAmISectionAdmin() const;
|
|
|
|
const QString& getDescription() const;
|
|
|
|
const QString& getImage() const;
|
|
|
|
const QString& getIcon() const;
|
|
|
|
const QString& getColor() const;
|
|
|
|
bool getHasNotification() const;
|
|
|
|
int getNotificationsCount() const;
|
|
|
|
bool getIsActive() const;
|
|
|
|
bool getIsEnabled() const;
|
|
|
|
bool getIsMember() const;
|
|
|
|
bool getHasJoined() const;
|
|
|
|
bool getCanJoin() const;
|
|
|
|
bool getCanManageUsers() const;
|
|
|
|
bool getCanRequestAccess() const;
|
|
|
|
int getAccess() const;
|
|
|
|
bool getIsEnsOnly() const;
|
|
|
|
|
|
|
|
// Setters
|
|
|
|
void setIsActive(bool isActive);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void activeChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SectionType m_sectionType;
|
|
|
|
QString m_id;
|
|
|
|
QString m_name;
|
|
|
|
bool m_amISectionAdmin;
|
|
|
|
QString m_description;
|
|
|
|
QString m_image;
|
|
|
|
QString m_icon;
|
|
|
|
QString m_color;
|
|
|
|
bool m_hasNotification;
|
|
|
|
int m_notificationsCount;
|
|
|
|
bool m_active;
|
|
|
|
bool m_enabled;
|
|
|
|
bool m_isMember;
|
|
|
|
bool m_joined;
|
|
|
|
bool m_canJoin;
|
|
|
|
bool m_canManageUsers;
|
|
|
|
bool m_canRequestAccess;
|
|
|
|
int m_access;
|
|
|
|
bool m_ensOnly;
|
|
|
|
// membersModel: user_model.Model
|
|
|
|
// pendingRequestsToJoinModel: PendingRequestModel
|
|
|
|
};
|
|
|
|
} // namespace Shared::Models
|