File indexing completed on 2024-05-12 16:25:36
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libruqola_private_export.h" 0010 #include <QDebug> 0011 #include <QString> 0012 0013 class LIBRUQOLACORE_TESTS_EXPORT Command 0014 { 0015 public: 0016 Command(); 0017 0018 [[nodiscard]] QString params() const; 0019 void setParams(const QString ¶ms); 0020 0021 [[nodiscard]] QString commandName() const; 0022 void setCommandName(const QString &commandName); 0023 0024 [[nodiscard]] QString description() const; 0025 void setDescription(const QString &description); 0026 0027 [[nodiscard]] bool clientOnly() const; 0028 void setClientOnly(bool clientOnly); 0029 0030 void parseCommand(const QJsonObject &obj); 0031 0032 [[nodiscard]] bool operator==(const Command &other) const; 0033 0034 [[nodiscard]] bool isValid() const; 0035 0036 [[nodiscard]] bool providesPreview() const; 0037 void setProvidesPreview(bool providesPreview); 0038 0039 [[nodiscard]] QStringList permissions() const; 0040 void setPermissions(const QStringList &permissions); 0041 0042 [[nodiscard]] QString translatedDescription() const; 0043 [[nodiscard]] QString translatedParams() const; 0044 0045 private: 0046 void convertDescriptionI18n(); 0047 void convertParamsI18n(); 0048 QStringList mPermissions; 0049 QString mParams; 0050 QString mCommandName; 0051 QString mDescription; 0052 QString mTranslatedDescription; 0053 QString mTranslatedParams; 0054 bool mProvidesPreview = false; 0055 bool mClientOnly = false; 0056 }; 0057 Q_DECLARE_METATYPE(Command) 0058 Q_DECLARE_TYPEINFO(Command, Q_MOVABLE_TYPE); 0059 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const Command &t);