Remove unused commandmodel
This commit is contained in:
@@ -1,68 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2021 Srevin Saju <srevinsaju@sugarlabs.org>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#include <KLocalizedString>
|
|
||||||
|
|
||||||
#include "commandmodel.h"
|
|
||||||
|
|
||||||
QVariantList CommandModel::filterModel(const QString &filter)
|
|
||||||
{
|
|
||||||
QVariantList result;
|
|
||||||
|
|
||||||
for (const QVariant &e : CommandModel::commands()) {
|
|
||||||
auto command = qvariant_cast<Command>(e);
|
|
||||||
if (command.command.startsWith(filter)) {
|
|
||||||
result.append(e);
|
|
||||||
if (result.length() > 10) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantList CommandModel::commands()
|
|
||||||
{
|
|
||||||
QVariantList commands;
|
|
||||||
|
|
||||||
// Messages commands
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/me "), QStringLiteral("<message>"), i18n("Displays action")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/shrug "), QStringLiteral("<message>"), i18n("Prepends ¯\\_(ツ)_/¯ to a plain-text message")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/lenny "), QStringLiteral("<message>"), i18n("Prepends ( ͡° ͜ʖ ͡°) to a plain-text message")}));
|
|
||||||
|
|
||||||
commands.append(
|
|
||||||
QVariant::fromValue(Command{QStringLiteral("/tableflip "), QStringLiteral("<message>"), i18n("Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message")}));
|
|
||||||
|
|
||||||
commands.append(
|
|
||||||
QVariant::fromValue(Command{QStringLiteral("/unflip "), QStringLiteral("<message>"), i18n("Prepends ┬──┬ ノ( ゜-゜ノ) to a plain-text message")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(
|
|
||||||
Command{QStringLiteral("/plain "), QStringLiteral("<message>"), i18n("Sends a message as plain text, without interpreting it as markdown")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(
|
|
||||||
Command{QStringLiteral("/html "), QStringLiteral("<message>"), i18n("Sends a message as html, without interpreting it as markdown")}));
|
|
||||||
|
|
||||||
commands.append(
|
|
||||||
QVariant::fromValue(Command{QStringLiteral("/rainbow "), QStringLiteral("<message>"), i18n("Sends the given message coloured as a rainbow")}));
|
|
||||||
|
|
||||||
commands.append(
|
|
||||||
QVariant::fromValue(Command{QStringLiteral("/rainbowme "), QStringLiteral("<message>"), i18n("Sends the given emote coloured as a rainbow")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/spoiler "), QStringLiteral("<message>"), i18n("Sends the given message as a spoiler")}));
|
|
||||||
|
|
||||||
// Actions commands
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/join "), QStringLiteral("<room-address>"), i18n("Joins room with given address")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/part "), QStringLiteral("[<room-address>]"), i18n("Leave room")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/invite "), QStringLiteral("<user-id>"), i18n("Invites user with given id to current room")}));
|
|
||||||
|
|
||||||
commands.append(QVariant::fromValue(Command{QStringLiteral("/react "), QStringLiteral("<reaction text>"), i18n("React to this message with a text")}));
|
|
||||||
|
|
||||||
// TODO more see elements /help action
|
|
||||||
|
|
||||||
return commands;
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2021 Srevin Saju <srevinsaju@sugarlabs.org>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
struct Command {
|
|
||||||
Command(const QString &p, const QString &a, const QString &h)
|
|
||||||
: command(p)
|
|
||||||
, parameter(a)
|
|
||||||
, help(h)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
Command() = default;
|
|
||||||
|
|
||||||
QString command;
|
|
||||||
QString parameter;
|
|
||||||
QString help;
|
|
||||||
|
|
||||||
Q_GADGET
|
|
||||||
Q_PROPERTY(QString command MEMBER command)
|
|
||||||
Q_PROPERTY(QString parameter MEMBER parameter)
|
|
||||||
Q_PROPERTY(QString help MEMBER help)
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Command)
|
|
||||||
|
|
||||||
class CommandModel : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit CommandModel(QObject *parent = nullptr)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_INVOKABLE QVariantList filterModel(const QString &filter);
|
|
||||||
static QVariantList commands();
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user