MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / changeReportType

Method changeReportType

gui/mainwindow.cpp:2303–2354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2301}
2302
2303void MainWindow::changeReportType() {
2304 const ReportType reportType = mUI->mActionReportAutosar->isChecked() ? ReportType::autosar :
2305 mUI->mActionReportCertC->isChecked() ? ReportType::certC :
2306 mUI->mActionReportCertCpp->isChecked() ? ReportType::certCpp :
2307 mUI->mActionReportMisraC->isChecked() ? (mProjectFile ? getMisraCReportType(mProjectFile->getCodingStandards()) : ReportType::misraC2012) :
2308 mUI->mActionReportMisraCpp2008->isChecked() ? ReportType::misraCpp2008 :
2309 mUI->mActionReportMisraCpp2023->isChecked() ? ReportType::misraCpp2023 :
2310 ReportType::normal;
2311
2312 mUI->mResults->setReportType(reportType);
2313
2314 auto setTextAndHint = [](QAction* a, const QString& s) {
2315 a->setVisible(!s.isEmpty());
2316 a->setText(s);
2317 a->setToolTip(s);
2318 };
2319
2320 const QString showMandatory = tr("Show Mandatory");
2321 const QString showRequired = tr("Show Required");
2322 const QString showAdvisory = tr("Show Advisory");
2323 const QString showDocument = tr("Show Document");
2324
2325 if (mUI->mActionReportAutosar->isChecked()) {
2326 setTextAndHint(mUI->mActionShowErrors, "");
2327 setTextAndHint(mUI->mActionShowWarnings, showRequired);
2328 setTextAndHint(mUI->mActionShowStyle, showAdvisory);
2329 setTextAndHint(mUI->mActionShowPortability, "");
2330 setTextAndHint(mUI->mActionShowPerformance, "");
2331 setTextAndHint(mUI->mActionShowInformation, "");
2332 } else if (mUI->mActionReportMisraC->isChecked() || mUI->mActionReportMisraCpp2008->isChecked() || mUI->mActionReportMisraCpp2023->isChecked()) {
2333 setTextAndHint(mUI->mActionShowErrors, mUI->mActionReportMisraCpp2008->isChecked() ? "" : showMandatory);
2334 setTextAndHint(mUI->mActionShowWarnings, showRequired);
2335 setTextAndHint(mUI->mActionShowStyle, showAdvisory);
2336 setTextAndHint(mUI->mActionShowPortability, "");
2337 setTextAndHint(mUI->mActionShowPerformance, "");
2338 setTextAndHint(mUI->mActionShowInformation, mUI->mActionReportMisraCpp2008->isChecked() ? showDocument : QString());
2339 } else if (mUI->mActionReportCertC->isChecked() || mUI->mActionReportCertCpp->isChecked()) {
2340 setTextAndHint(mUI->mActionShowErrors, tr("Show L1"));
2341 setTextAndHint(mUI->mActionShowWarnings, tr("Show L2"));
2342 setTextAndHint(mUI->mActionShowStyle, tr("Show L3"));
2343 setTextAndHint(mUI->mActionShowPortability, "");
2344 setTextAndHint(mUI->mActionShowPerformance, "");
2345 setTextAndHint(mUI->mActionShowInformation, "");
2346 } else {
2347 setTextAndHint(mUI->mActionShowErrors, tr("Show errors"));
2348 setTextAndHint(mUI->mActionShowWarnings, tr("Show warnings"));
2349 setTextAndHint(mUI->mActionShowStyle, tr("Show style"));
2350 setTextAndHint(mUI->mActionShowPortability, tr("Show portability"));
2351 setTextAndHint(mUI->mActionShowPerformance, tr("Show performance"));
2352 setTextAndHint(mUI->mActionShowInformation, tr("Show information"));
2353 }
2354}
2355
2356std::list<FileWithDetails> MainWindow::enrichFilesForAnalysis(const QStringList& fileNames, const Settings& settings) const {
2357 std::list<FileWithDetails> fdetails;

Callers

nothing calls this directly

Calls 4

getMisraCReportTypeFunction · 0.85
isEmptyMethod · 0.80
QStringClass · 0.70
setReportTypeMethod · 0.45

Tested by

no test coverage detected