Files
neochat/src/models/keywordnotificationrulemodel.h
James Graham 594a5cf6ca Move the qt models to their own folder
Felt like the src folder was getting a bit crowded so move all the models to a folder named models.
2023-01-22 21:33:30 +00:00

36 lines
1008 B
C++

// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#pragma once
#include <csapi/definitions/push_rule.h>
#include <QAbstractListModel>
class KeywordNotificationRuleModel : public QAbstractListModel
{
Q_OBJECT
public:
enum EventRoles {
NameRole = Qt::DisplayRole,
};
KeywordNotificationRuleModel(QObject *parent = nullptr);
[[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void addKeyword(const QString &keyword);
Q_INVOKABLE void removeKeywordAtIndex(int index);
private Q_SLOTS:
void controllerConnectionChanged();
void updateNotificationRules(const QString &type);
private:
QList<QString> m_notificationRules;
};