2022-02-22 08:02:34 +00:00
|
|
|
#pragma once
|
2022-02-16 21:51:04 +00:00
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QHash>
|
2022-02-21 18:03:38 +00:00
|
|
|
#include <QPointer>
|
2022-02-16 21:51:04 +00:00
|
|
|
#include <QVector>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "section_item.h"
|
|
|
|
|
|
|
|
namespace Shared::Models
|
|
|
|
{
|
|
|
|
class SectionModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ModelRole
|
|
|
|
{
|
|
|
|
Id = Qt::UserRole + 1,
|
|
|
|
SectionType,
|
|
|
|
Name,
|
|
|
|
AmISectionAdmin,
|
|
|
|
Description,
|
|
|
|
Image,
|
|
|
|
Icon,
|
|
|
|
Color,
|
|
|
|
HasNotification,
|
|
|
|
NotificationsCount,
|
|
|
|
Active,
|
|
|
|
Enabled,
|
|
|
|
Joined,
|
|
|
|
IsMember,
|
|
|
|
CanJoin,
|
|
|
|
CanManageUsers,
|
|
|
|
CanRequestAccess,
|
|
|
|
Access,
|
|
|
|
EnsOnly,
|
|
|
|
MembersModel,
|
|
|
|
PendingRequestsToJoinModel
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit SectionModel(QObject* parent = nullptr);
|
|
|
|
~SectionModel() = default;
|
|
|
|
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
int rowCount(const QModelIndex&) const override;
|
|
|
|
QVariant data(const QModelIndex& index, int role) const override;
|
|
|
|
|
|
|
|
void addItem(SectionItem* item);
|
2022-02-21 18:03:38 +00:00
|
|
|
void setActiveSection(const QString& Id);
|
2022-02-22 08:02:34 +00:00
|
|
|
QPointer<SectionItem> getActiveItem() const;
|
2022-02-16 21:51:04 +00:00
|
|
|
|
|
|
|
// To add other api's later as needed
|
|
|
|
|
|
|
|
private:
|
|
|
|
QVector<SectionItem*> m_items;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Shared::Models
|