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

Method save

gui/mainwindow.cpp:1668–1704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1666}
1667
1668void MainWindow::save()
1669{
1670 QString selectedFilter;
1671 const QString filter(tr("XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
1672 QString selectedFile = QFileDialog::getSaveFileName(this,
1673 tr("Save the report file"),
1674 getPath(SETTINGS_LAST_RESULT_PATH),
1675 filter,
1676 &selectedFilter);
1677
1678 if (!selectedFile.isEmpty()) {
1679 Report::Type type = Report::TXT;
1680 if (selectedFilter == tr("XML files (*.xml)")) {
1681 type = Report::XMLV2;
1682 if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive))
1683 selectedFile += ".xml";
1684 } else if (selectedFilter == tr("Text files (*.txt)")) {
1685 type = Report::TXT;
1686 if (!selectedFile.endsWith(".txt", Qt::CaseInsensitive))
1687 selectedFile += ".txt";
1688 } else if (selectedFilter == tr("CSV files (*.csv)")) {
1689 type = Report::CSV;
1690 if (!selectedFile.endsWith(".csv", Qt::CaseInsensitive))
1691 selectedFile += ".csv";
1692 } else {
1693 if (selectedFile.endsWith(".xml", Qt::CaseInsensitive))
1694 type = Report::XMLV2;
1695 else if (selectedFile.endsWith(".txt", Qt::CaseInsensitive))
1696 type = Report::TXT;
1697 else if (selectedFile.endsWith(".csv", Qt::CaseInsensitive))
1698 type = Report::CSV;
1699 }
1700
1701 mUI->mResults->save(selectedFile, type, mCppcheckCfgProductName);
1702 setPath(SETTINGS_LAST_RESULT_PATH, selectedFile);
1703 }
1704}
1705
1706void MainWindow::resultsAdded()
1707{

Callers 1

analysisDoneMethod · 0.45

Calls 4

getPathFunction · 0.85
setPathFunction · 0.85
isEmptyMethod · 0.80
endsWithMethod · 0.80

Tested by

no test coverage detected