| 144 | } |
| 145 | |
| 146 | void StatsDialog::setScanDuration(double seconds) |
| 147 | { |
| 148 | // Factor the duration into units (days/hours/minutes/seconds) |
| 149 | int secs = static_cast<int>(seconds); |
| 150 | const int days = secs / (24 * 60 * 60); |
| 151 | secs -= days * (24 * 60 * 60); |
| 152 | const int hours = secs / (60 * 60); |
| 153 | secs -= hours * (60 * 60); |
| 154 | const int mins = secs / 60; |
| 155 | secs -= mins * 60; |
| 156 | |
| 157 | // Concatenate the two most significant units (e.g. "1 day and 3 hours") |
| 158 | QStringList parts; |
| 159 | if (days) |
| 160 | parts << ((days == 1) ? tr("1 day") : tr("%1 days").arg(days)); |
| 161 | if (hours) |
| 162 | parts << ((hours == 1) ? tr("1 hour") : tr("%1 hours").arg(hours)); |
| 163 | if (mins && parts.size() < 2) |
| 164 | parts << ((mins == 1) ? tr("1 minute") : tr("%1 minutes").arg(mins)); |
| 165 | if (secs && parts.size() < 2) |
| 166 | parts << ((secs == 1) ? tr("1 second") : tr("%1 seconds").arg(secs)); |
| 167 | |
| 168 | // For durations < 1s, show the fraction of a second (e.g. "0.7 seconds") |
| 169 | if (parts.isEmpty()) |
| 170 | parts << tr("0.%1 seconds").arg(int(10.0 *(seconds - secs))); |
| 171 | |
| 172 | mUI->mScanDuration->setText(parts.join(tr(" and "))); |
| 173 | } |
| 174 | void StatsDialog::pdfExport() |
| 175 | { |
| 176 | const QString Stat = QString( |
no test coverage detected