* @brief List all actions */
| 3955 | * @brief List all actions |
| 3956 | */ |
| 3957 | API::CommandResponse API::Handlers::ProjectHandler::actionsList(const QString& id, |
| 3958 | const QJsonObject& params) |
| 3959 | { |
| 3960 | Q_UNUSED(params) |
| 3961 | |
| 3962 | const auto& actions = DataModel::ProjectModel::instance().actions(); |
| 3963 | |
| 3964 | QJsonArray actions_array; |
| 3965 | for (const auto& action : actions) { |
| 3966 | QJsonObject obj; |
| 3967 | obj[QStringLiteral("actionId")] = action.actionId; |
| 3968 | obj[QStringLiteral("title")] = action.title; |
| 3969 | obj[QStringLiteral("icon")] = action.icon; |
| 3970 | obj[QStringLiteral("txData")] = action.txData; |
| 3971 | actions_array.append(obj); |
| 3972 | } |
| 3973 | |
| 3974 | QJsonObject result; |
| 3975 | result[QStringLiteral("actions")] = actions_array; |
| 3976 | result[QStringLiteral("actionCount")] = static_cast<int>(actions.size()); |
| 3977 | |
| 3978 | return CommandResponse::makeSuccess(id, result); |
| 3979 | } |
| 3980 | |
| 3981 | /** |
| 3982 | * @brief Load project configuration from JSON object |