| 666 | } |
| 667 | |
| 668 | void KDevelop::RunController::checkState() |
| 669 | { |
| 670 | Q_D(RunController); |
| 671 | |
| 672 | bool running = false; |
| 673 | |
| 674 | int jobCount = 0; |
| 675 | int totalProgress = 0; |
| 676 | |
| 677 | for (auto it = d->jobs.constBegin(), end = d->jobs.constEnd(); it != end; ++it) { |
| 678 | KJob *job = it.key(); |
| 679 | |
| 680 | if (!job->isSuspended()) { |
| 681 | running = true; |
| 682 | |
| 683 | ++jobCount; |
| 684 | totalProgress += job->percent(); |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | d->unityLauncher->setProgressVisible(running); |
| 689 | if (jobCount > 0) { |
| 690 | d->unityLauncher->setProgress((totalProgress + 1) / jobCount); |
| 691 | } else { |
| 692 | d->unityLauncher->setProgress(0); |
| 693 | } |
| 694 | |
| 695 | if ( ( d->state != Running ? false : true ) == running ) { |
| 696 | d->state = running ? Running : Idle; |
| 697 | emit runStateChanged(d->state); |
| 698 | } |
| 699 | |
| 700 | if (Core::self()->setupFlags() != Core::NoUi) { |
| 701 | d->stopAction->setEnabled(running); |
| 702 | d->stopJobsMenu->setEnabled(running); |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | void KDevelop::RunController::stopAllProcesses() |
| 707 | { |
no test coverage detected