* @brief Get information about all available commands */
| 196 | * @brief Get information about all available commands |
| 197 | */ |
| 198 | QJsonObject API::CommandHandler::getAvailableCommands() const |
| 199 | { |
| 200 | QJsonObject result; |
| 201 | QJsonArray commandList; |
| 202 | |
| 203 | const auto& commands = CommandRegistry::instance().commands(); |
| 204 | for (auto it = commands.constBegin(); it != commands.constEnd(); ++it) { |
| 205 | QJsonObject cmdInfo; |
| 206 | cmdInfo[QStringLiteral("name")] = it.key(); |
| 207 | cmdInfo[QStringLiteral("description")] = it.value().description; |
| 208 | commandList.append(cmdInfo); |
| 209 | } |
| 210 | |
| 211 | result[QStringLiteral("commands")] = commandList; |
| 212 | return result; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * @brief Initialize all command handlers |