| 644 | } |
| 645 | |
| 646 | void |
| 647 | SourceWidget::setProcessRate(unsigned int rate) |
| 648 | { |
| 649 | if (rate != this->processRate) { |
| 650 | SUFLOAT percentUsage = 1; |
| 651 | this->processRate = rate; |
| 652 | |
| 653 | if (this->rate == 0 || this->processRate == 0) { |
| 654 | this->ui->processingRateLabel->setText("N/A"); |
| 655 | this->ui->deliveryProgress->setEnabled(false); |
| 656 | } else { |
| 657 | this->ui->deliveryProgress->setEnabled(true); |
| 658 | this->ui->processingRateLabel->setText( |
| 659 | SuWidgetsHelpers::formatQuantity(this->processRate, 4, "sp/s")); |
| 660 | percentUsage = |
| 661 | static_cast<SUFLOAT>(this->processRate) / |
| 662 | static_cast<SUFLOAT>(this->getEffectiveRate()); |
| 663 | } |
| 664 | |
| 665 | if (percentUsage <= 1) { |
| 666 | this->ui->deliveryProgress->setValue(static_cast<int>(percentUsage * 100)); |
| 667 | } else { |
| 668 | this->ui->deliveryProgress->setValue(100); |
| 669 | } |
| 670 | |
| 671 | if (percentUsage >= SU_ADDSFX(.95)) |
| 672 | this->ui->deliveryLabel->setPixmap( |
| 673 | QPixmap(QString::fromUtf8(":/icons/transparent.png"))); |
| 674 | else if (percentUsage >= SU_ADDSFX(.85)) |
| 675 | this->ui->deliveryLabel->setPixmap( |
| 676 | QPixmap(QString::fromUtf8(":/icons/warning.png"))); |
| 677 | else |
| 678 | this->ui->deliveryLabel->setPixmap( |
| 679 | QPixmap(QString::fromUtf8(":/icons/critical.png"))); |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | void |
| 684 | SourceWidget::refreshAutoGains(Suscan::Source::Config &config) |
no test coverage detected