2022-02-12 21:27:51 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QVariantList>
|
|
|
|
|
2022-06-18 02:35:30 +03:00
|
|
|
#include <mtx/events/event_type.hpp>
|
2022-02-12 21:27:51 +03:00
|
|
|
|
|
|
|
class HiddenEvents : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString roomid READ roomid WRITE setRoomid NOTIFY roomidChanged REQUIRED)
|
|
|
|
Q_PROPERTY(QVariantList hiddenEvents READ hiddenEvents NOTIFY hiddenEventsChanged)
|
|
|
|
public:
|
|
|
|
explicit HiddenEvents(QObject *p = nullptr)
|
|
|
|
: QObject(p)
|
2022-05-10 04:53:35 +03:00
|
|
|
{}
|
2022-02-12 21:27:51 +03:00
|
|
|
|
|
|
|
Q_INVOKABLE void toggle(int type);
|
|
|
|
Q_INVOKABLE void save();
|
|
|
|
|
|
|
|
[[nodiscard]] QString roomid() const { return roomid_; }
|
|
|
|
void setRoomid(const QString &r)
|
|
|
|
{
|
|
|
|
roomid_ = r;
|
|
|
|
emit roomidChanged();
|
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] QVariantList hiddenEvents() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void roomidChanged();
|
|
|
|
void hiddenEventsChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString roomid_;
|
|
|
|
std::vector<mtx::events::EventType> hiddenEvents_;
|
|
|
|
|
|
|
|
void load();
|
|
|
|
};
|