| 91 | } |
| 92 | |
| 93 | void StatsDialog::setProject(const ProjectFile* projectFile) |
| 94 | { |
| 95 | if (projectFile) { |
| 96 | mUI->mProject->setText(projectFile->getRootPath()); |
| 97 | mUI->mPaths->setText(projectFile->getCheckPaths().join(";")); |
| 98 | mUI->mIncludePaths->setText(projectFile->getIncludeDirs().join(";")); |
| 99 | mUI->mDefines->setText(projectFile->getDefines().join(";")); |
| 100 | mUI->mUndefines->setText(projectFile->getUndefines().join(";")); |
| 101 | #ifndef QT_CHARTS_LIB |
| 102 | mUI->mTabHistory->setVisible(false); |
| 103 | #else |
| 104 | QString statsFile; |
| 105 | if (!projectFile->getBuildDir().isEmpty()) { |
| 106 | const QString prjpath = QFileInfo(projectFile->getFilename()).absolutePath(); |
| 107 | const QString buildDir = prjpath + '/' + projectFile->getBuildDir(); |
| 108 | if (QDir(buildDir).exists()) { |
| 109 | statsFile = buildDir + "/statistics.txt"; |
| 110 | } |
| 111 | } |
| 112 | mUI->mLblHistoryFile->setText(tr("File: ") + (statsFile.isEmpty() ? tr("No cppcheck build dir") : statsFile)); |
| 113 | if (!statsFile.isEmpty()) { |
| 114 | QChartView *chartView = createChart(statsFile, "cppcheck"); |
| 115 | mUI->mTabHistory->layout()->addWidget(chartView); |
| 116 | // cppcheck-suppress knownConditionTrueFalse - TODO in getClangAnalyzer() |
| 117 | if (projectFile->getClangAnalyzer()) { |
| 118 | chartView = createChart(statsFile, CLANG_ANALYZER); |
| 119 | mUI->mTabHistory->layout()->addWidget(chartView); |
| 120 | } |
| 121 | if (projectFile->getClangTidy()) { |
| 122 | chartView = createChart(statsFile, CLANG_TIDY); |
| 123 | mUI->mTabHistory->layout()->addWidget(chartView); |
| 124 | } |
| 125 | } |
| 126 | #endif |
| 127 | } else { |
| 128 | mUI->mProject->setText(QString()); |
| 129 | mUI->mPaths->setText(QString()); |
| 130 | mUI->mIncludePaths->setText(QString()); |
| 131 | mUI->mDefines->setText(QString()); |
| 132 | mUI->mUndefines->setText(QString()); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | void StatsDialog::setPathSelected(const QString& path) |
| 137 | { |
no test coverage detected