From b8eb18d7bc4b09bab043c88f0ddeafe029b1b29e Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Thu, 17 Nov 2022 20:30:50 +0100 Subject: [PATCH] Remove unused commandmodel --- src/commandmodel.cpp | 68 -------------------------------------------- src/commandmodel.h | 41 -------------------------- 2 files changed, 109 deletions(-) delete mode 100644 src/commandmodel.cpp delete mode 100644 src/commandmodel.h diff --git a/src/commandmodel.cpp b/src/commandmodel.cpp deleted file mode 100644 index cdfe53145..000000000 --- a/src/commandmodel.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Srevin Saju -// SPDX-License-Identifier: GPL-3.0-or-later - -#include - -#include "commandmodel.h" - -QVariantList CommandModel::filterModel(const QString &filter) -{ - QVariantList result; - - for (const QVariant &e : CommandModel::commands()) { - auto command = qvariant_cast(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(""), i18n("Displays action")})); - - commands.append(QVariant::fromValue(Command{QStringLiteral("/shrug "), QStringLiteral(""), i18n("Prepends ¯\\_(ツ)_/¯ to a plain-text message")})); - - commands.append(QVariant::fromValue(Command{QStringLiteral("/lenny "), QStringLiteral(""), i18n("Prepends ( ͡° ͜ʖ ͡°) to a plain-text message")})); - - commands.append( - QVariant::fromValue(Command{QStringLiteral("/tableflip "), QStringLiteral(""), i18n("Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message")})); - - commands.append( - QVariant::fromValue(Command{QStringLiteral("/unflip "), QStringLiteral(""), i18n("Prepends ┬──┬ ノ( ゜-゜ノ) to a plain-text message")})); - - commands.append(QVariant::fromValue( - Command{QStringLiteral("/plain "), QStringLiteral(""), i18n("Sends a message as plain text, without interpreting it as markdown")})); - - commands.append(QVariant::fromValue( - Command{QStringLiteral("/html "), QStringLiteral(""), i18n("Sends a message as html, without interpreting it as markdown")})); - - commands.append( - QVariant::fromValue(Command{QStringLiteral("/rainbow "), QStringLiteral(""), i18n("Sends the given message coloured as a rainbow")})); - - commands.append( - QVariant::fromValue(Command{QStringLiteral("/rainbowme "), QStringLiteral(""), i18n("Sends the given emote coloured as a rainbow")})); - - commands.append(QVariant::fromValue(Command{QStringLiteral("/spoiler "), QStringLiteral(""), i18n("Sends the given message as a spoiler")})); - - // Actions commands - commands.append(QVariant::fromValue(Command{QStringLiteral("/join "), QStringLiteral(""), i18n("Joins room with given address")})); - - commands.append(QVariant::fromValue(Command{QStringLiteral("/part "), QStringLiteral("[]"), i18n("Leave room")})); - - commands.append(QVariant::fromValue(Command{QStringLiteral("/invite "), QStringLiteral(""), i18n("Invites user with given id to current room")})); - - commands.append(QVariant::fromValue(Command{QStringLiteral("/react "), QStringLiteral(""), i18n("React to this message with a text")})); - - // TODO more see elements /help action - - return commands; -} diff --git a/src/commandmodel.h b/src/commandmodel.h deleted file mode 100644 index 9080740e0..000000000 --- a/src/commandmodel.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Srevin Saju -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -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(); -};