refactor: move ActionHandler::commands to CommandModel::commands

This commit is contained in:
Srevin Saju
2021-05-05 19:58:34 +03:00
parent 461128c6a7
commit 584cd59f93
4 changed files with 78 additions and 94 deletions

View File

@@ -10,30 +10,14 @@
#include <utility>
struct Command {
Command(QString p, QString a, QString h)
: command(std::move(std::move(p)))
, parameter(std::move(std::move(a)))
, help(std::move(std::move(h)))
Command(const QString &p, const QString &a, const QString &h)
: command(p)
, parameter(a)
, help(h)
{
}
Command() = default;
friend QDataStream &operator<<(QDataStream &arch, const Command &object)
{
arch << object.command;
arch << object.parameter;
arch << object.help;
return arch;
}
friend QDataStream &operator>>(QDataStream &arch, Command &object)
{
arch >> object.command;
arch >> object.parameter;
arch >> object.help;
return arch;
}
QString command;
QString parameter;
QString help;
@@ -42,6 +26,7 @@ Q_GADGET
Q_PROPERTY(QString command MEMBER command)
Q_PROPERTY(QString parameter MEMBER parameter)
Q_PROPERTY(QString help MEMBER help)
};
Q_DECLARE_METATYPE(Command)
@@ -57,5 +42,5 @@ public:
}
Q_INVOKABLE QVariantList filterModel(const QString &filter);
static QVariantList commands();
};