| 368 | } |
| 369 | |
| 370 | void BinaryToolsManager::executeTool(const QString &id) |
| 371 | { |
| 372 | const auto &tool = this->findTool(id); |
| 373 | if (!tool.isValid()) |
| 374 | return; |
| 375 | |
| 376 | if (!checkCommandExists(tool.command)) |
| 377 | return toolMissingHint(tool); |
| 378 | |
| 379 | AppOutputPane::instance()->createApplicationPane(id, tool.name); |
| 380 | auto stopHandler = std::bind(&BinaryToolsManager::stopTool, this, id); |
| 381 | AppOutputPane::instance()->setStopHandler(id, stopHandler); |
| 382 | QString startMsg = tr("Start execute tool \"%1\".\n").arg(tool.name); |
| 383 | printOutput(id, startMsg, OutputPane::NormalMessage); |
| 384 | uiController.switchContext(tr("&Application Output")); |
| 385 | |
| 386 | auto toolProcess = createToolProcess(tool); |
| 387 | if (!toolProcess) { |
| 388 | printOutput(id, tr("The tool is running. Please stop it before running.\n"), OutputPane::ErrorMessage); |
| 389 | return; |
| 390 | } |
| 391 | |
| 392 | QString errorMsg; |
| 393 | if (!checkAndSetProcessParams(toolProcess, tool, errorMsg)) { |
| 394 | printOutput(id, errorMsg, OutputPane::ErrorMessage); |
| 395 | stopTool(id); |
| 396 | toolTaskMap.remove(id); |
| 397 | AppOutputPane::instance()->setProcessFinished(id); |
| 398 | return; |
| 399 | } |
| 400 | |
| 401 | Q_EMIT execute(id); |
| 402 | } |
| 403 | |
| 404 | void BinaryToolsManager::checkAndAddToToolbar(const BinaryTools &tools) |
| 405 | { |
nothing calls this directly
no test coverage detected