2023-02-22 01:48:49 +03:00
|
|
|
// SPDX-FileCopyrightText: Nheko Contributors
|
2022-11-09 06:58:19 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
class CommandCompleter final : public QAbstractListModel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Roles
|
|
|
|
{
|
|
|
|
Name = Qt::UserRole,
|
|
|
|
Description,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Commands
|
|
|
|
{
|
|
|
|
Me,
|
|
|
|
React,
|
|
|
|
Join,
|
|
|
|
Knock,
|
|
|
|
Part,
|
|
|
|
Leave,
|
|
|
|
Invite,
|
|
|
|
Kick,
|
|
|
|
Ban,
|
|
|
|
Unban,
|
|
|
|
Redact,
|
|
|
|
Roomnick,
|
|
|
|
Shrug,
|
|
|
|
Fliptable,
|
|
|
|
Unfliptable,
|
|
|
|
Sovietflip,
|
|
|
|
ClearTimeline,
|
|
|
|
ResetState,
|
|
|
|
RotateMegolmSession,
|
|
|
|
Md,
|
2023-01-31 20:22:12 +03:00
|
|
|
Cmark,
|
2022-11-09 06:58:19 +03:00
|
|
|
Plain,
|
|
|
|
Rainbow,
|
|
|
|
RainbowMe,
|
|
|
|
Notice,
|
|
|
|
RainbowNotice,
|
2022-12-10 18:17:15 +03:00
|
|
|
Confetti,
|
|
|
|
RainbowConfetti,
|
2023-03-07 21:11:00 +03:00
|
|
|
Rainfall,
|
2023-03-22 02:44:00 +03:00
|
|
|
Msgtype,
|
2022-11-09 06:58:19 +03:00
|
|
|
Goto,
|
|
|
|
ConvertToDm,
|
|
|
|
ConvertToRoom,
|
2023-12-12 04:29:36 +03:00
|
|
|
Ignore,
|
2023-12-18 02:17:43 +03:00
|
|
|
Unignore,
|
2022-11-09 06:58:19 +03:00
|
|
|
COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
CommandCompleter(QObject *parent = nullptr);
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override
|
|
|
|
{
|
|
|
|
(void)parent;
|
|
|
|
return (int)Commands::COUNT;
|
|
|
|
}
|
|
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
|
|
};
|