| 445 | } |
| 446 | |
| 447 | void cmCursesMainForm::UpdateProgress(std::string const& msg, float prog) |
| 448 | { |
| 449 | if (prog >= 0) { |
| 450 | constexpr int progressBarWidth = 40; |
| 451 | int progressBarCompleted = static_cast<int>(progressBarWidth * prog); |
| 452 | int percentCompleted = static_cast<int>(100 * prog); |
| 453 | this->LastProgress = (percentCompleted < 100 ? " " : ""); |
| 454 | this->LastProgress += (percentCompleted < 10 ? " " : ""); |
| 455 | this->LastProgress += std::to_string(percentCompleted) + "% ["; |
| 456 | this->LastProgress.append(progressBarCompleted, '#'); |
| 457 | this->LastProgress.append(progressBarWidth - progressBarCompleted, ' '); |
| 458 | this->LastProgress += "] " + msg + "..."; |
| 459 | this->DisplayOutputs(std::string()); |
| 460 | } else { |
| 461 | this->Outputs.emplace_back(msg); |
| 462 | this->DisplayOutputs(msg); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | void cmCursesMainForm::Write() |
| 467 | { |
no test coverage detected