| 172 | mUI->mScanDuration->setText(parts.join(tr(" and "))); |
| 173 | } |
| 174 | void StatsDialog::pdfExport() |
| 175 | { |
| 176 | const QString Stat = QString( |
| 177 | "<center><h1>%1 %2</h1></center>\n" |
| 178 | "<font color=\"red\"><h3>%3 : %4</h3></font>\n" |
| 179 | "<font color=\"green\"><h3>%5 : %6</h3></font>\n" |
| 180 | "<font color=\"orange\"><h3>%7 : %8</h3></font>\n" |
| 181 | "<font color=\"blue\"><h3>%9 : %10</h3></font>\n" |
| 182 | "<font color=\"blue\"><h3>%11 : %12</h3></font>\n" |
| 183 | "<font color=\"purple\"><h3>%13 : %14</h3></font>\n") |
| 184 | .arg(tr("Statistics")) |
| 185 | .arg(QDate::currentDate().toString("dd.MM.yyyy")) |
| 186 | .arg(tr("Errors")) |
| 187 | .arg(mStatistics->getCount(CPPCHECK,ShowTypes::ShowErrors)) |
| 188 | .arg(tr("Warnings")) |
| 189 | .arg(mStatistics->getCount(CPPCHECK,ShowTypes::ShowWarnings)) |
| 190 | .arg(tr("Style warnings")) |
| 191 | .arg(mStatistics->getCount(CPPCHECK,ShowTypes::ShowStyle)) |
| 192 | .arg(tr("Portability warnings")) |
| 193 | .arg(mStatistics->getCount(CPPCHECK,ShowTypes::ShowPortability)) |
| 194 | .arg(tr("Performance warnings")) |
| 195 | .arg(mStatistics->getCount(CPPCHECK,ShowTypes::ShowPerformance)) |
| 196 | .arg(tr("Information messages")) |
| 197 | .arg(mStatistics->getCount(CPPCHECK,ShowTypes::ShowInformation)); |
| 198 | |
| 199 | QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Export PDF"), QString(), "*.pdf"); |
| 200 | if (QFileInfo(fileName).suffix().isEmpty()) { |
| 201 | fileName.append(".pdf"); |
| 202 | } |
| 203 | QPrinter printer(QPrinter::PrinterResolution); |
| 204 | printer.setOutputFormat(QPrinter::PdfFormat); |
| 205 | printer.setPageSize(QPageSize(QPageSize::A4)); |
| 206 | printer.setOutputFileName(fileName); |
| 207 | |
| 208 | QTextDocument doc; |
| 209 | doc.setHtml(Stat); |
| 210 | // doc.setPageSize(printer.pageRect().size()); |
| 211 | doc.print(&printer); |
| 212 | |
| 213 | } |
| 214 | |
| 215 | void StatsDialog::copyToClipboard() |
| 216 | { |