GUI: Add new CSV report type.

CSV files are handy (and commonly used) to export/import data to other programs. CSV reports allow easy import of cppcheck error data to other programs for further processing.
This commit is contained in:
Kimmo Varis 2009-07-06 12:30:49 +03:00
parent d4e6d42104
commit 58c21dde1c
12 changed files with 378 additions and 177 deletions

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -116,10 +116,10 @@ kate -l(line) (file)</source>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="238"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="456"/> <location filename="mainwindow.cpp" line="458"/>
<location filename="mainwindow.cpp" line="554"/> <location filename="mainwindow.cpp" line="561"/>
<location filename="mainwindow.cpp" line="572"/> <location filename="mainwindow.cpp" line="579"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -284,59 +284,64 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="201"/> <location filename="mainwindow.cpp" line="202"/>
<source>Select files to check</source> <source>Select files to check</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="210"/> <location filename="mainwindow.cpp" line="211"/>
<source>Select directory to check</source> <source>Select directory to check</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="240"/>
<source>No suitable files found to check!</source> <source>No suitable files found to check!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="452"/> <location filename="mainwindow.cpp" line="454"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="498"/> <location filename="mainwindow.cpp" line="500"/>
<source>License</source> <source>License</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Authors</source> <source>Authors</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="515"/> <location filename="mainwindow.cpp" line="517"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="523"/> <location filename="mainwindow.cpp" line="525"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="556"/> <location filename="mainwindow.cpp" line="531"/>
<source>Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="563"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="573"/> <location filename="mainwindow.cpp" line="580"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -397,25 +402,25 @@ Stop the checking before exiting.</source>
<name>ResultsTree</name> <name>ResultsTree</name>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>File</source> <source>File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Severity</source> <source>Severity</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Line</source> <source>Line</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -453,22 +458,22 @@ Please check the application path and parameters are correct.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="612"/> <location filename="resultstree.cpp" line="613"/>
<source>all</source> <source>all</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="616"/> <location filename="resultstree.cpp" line="617"/>
<source>style</source> <source>style</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="620"/> <location filename="resultstree.cpp" line="621"/>
<source>security</source> <source>security</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="624"/> <location filename="resultstree.cpp" line="625"/>
<source>error</source> <source>error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -476,18 +481,18 @@ Please check the application path and parameters are correct.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="77"/> <location filename="resultsview.cpp" line="79"/>
<location filename="resultsview.cpp" line="89"/> <location filename="resultsview.cpp" line="91"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="78"/> <location filename="resultsview.cpp" line="80"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="86"/> <location filename="resultsview.cpp" line="88"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation>Cppcheck - A tool for static C/C++ code analysis.</translation> <translation>Cppcheck - A tool for static C/C++ code analysis.</translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</translation> <translation>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</translation>
@ -129,10 +129,10 @@ kate -l(line) (file)</translation>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="238"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="456"/> <location filename="mainwindow.cpp" line="458"/>
<location filename="mainwindow.cpp" line="554"/> <location filename="mainwindow.cpp" line="561"/>
<location filename="mainwindow.cpp" line="572"/> <location filename="mainwindow.cpp" line="579"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -297,22 +297,22 @@ kate -l(line) (file)</translation>
<translation>&amp;Help</translation> <translation>&amp;Help</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="201"/> <location filename="mainwindow.cpp" line="202"/>
<source>Select files to check</source> <source>Select files to check</source>
<translation>Select files to check</translation> <translation>Select files to check</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="210"/> <location filename="mainwindow.cpp" line="211"/>
<source>Select directory to check</source> <source>Select directory to check</source>
<translation>Select directory to check</translation> <translation>Select directory to check</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="240"/>
<source>No suitable files found to check!</source> <source>No suitable files found to check!</source>
<translation>No suitable files found to check!</translation> <translation>No suitable files found to check!</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="452"/> <location filename="mainwindow.cpp" line="454"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
@ -321,37 +321,46 @@ Stop the checking before exiting.</source>
Stop the checking before exiting.</translation> Stop the checking before exiting.</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="498"/> <location filename="mainwindow.cpp" line="500"/>
<source>License</source> <source>License</source>
<translation>License</translation> <translation>License</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Authors</source> <source>Authors</source>
<translation>Authors</translation> <translation>Authors</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML files (*.xml);;Text files (*.txt)</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="515"/> <source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="obsolete">XML files (*.xml);;Text files (*.txt)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="517"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation>Save the report file</translation> <translation>Save the report file</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="523"/> <location filename="mainwindow.cpp" line="525"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML files (*.xml)</translation> <translation>XML files (*.xml)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="556"/> <location filename="mainwindow.cpp" line="531"/>
<source>Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="563"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="573"/> <location filename="mainwindow.cpp" line="580"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -414,25 +423,25 @@ Stop the checking before exiting.</translation>
<name>ResultsTree</name> <name>ResultsTree</name>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>File</source> <source>File</source>
<translation>File</translation> <translation>File</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Severity</source> <source>Severity</source>
<translation>Severity</translation> <translation>Severity</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Line</source> <source>Line</source>
<translation>Line</translation> <translation>Line</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Message</source> <source>Message</source>
<translation>Message</translation> <translation>Message</translation>
</message> </message>
@ -472,22 +481,22 @@ Please check the application path and parameters are correct.</source>
Please check the application path and parameters are correct.</translation> Please check the application path and parameters are correct.</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="612"/> <location filename="resultstree.cpp" line="613"/>
<source>all</source> <source>all</source>
<translation>All</translation> <translation>All</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="616"/> <location filename="resultstree.cpp" line="617"/>
<source>style</source> <source>style</source>
<translation>Style</translation> <translation>Style</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="620"/> <location filename="resultstree.cpp" line="621"/>
<source>security</source> <source>security</source>
<translation>Security</translation> <translation>Security</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="624"/> <location filename="resultstree.cpp" line="625"/>
<source>error</source> <source>error</source>
<translation>Error</translation> <translation>Error</translation>
</message> </message>
@ -495,18 +504,18 @@ Please check the application path and parameters are correct.</translation>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="77"/> <location filename="resultsview.cpp" line="79"/>
<location filename="resultsview.cpp" line="89"/> <location filename="resultsview.cpp" line="91"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="78"/> <location filename="resultsview.cpp" line="80"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>No errors found.</translation> <translation>No errors found.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="86"/> <location filename="resultsview.cpp" line="88"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Errors were found, but they are configured to be hidden. <translation>Errors were found, but they are configured to be hidden.

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation>Cppcheck - Työkalu C/C++ koodin staattiseen analysointiin.</translation> <translation>Cppcheck - Työkalu C/C++ koodin staattiseen analysointiin.</translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation>Copyright (C) 2007-2009 Daniel Marjamäki ja cppcheck tiimi.</translation> <translation>Copyright (C) 2007-2009 Daniel Marjamäki ja cppcheck tiimi.</translation>
@ -131,10 +131,10 @@ kate -l(line) (file)
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="238"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="456"/> <location filename="mainwindow.cpp" line="458"/>
<location filename="mainwindow.cpp" line="554"/> <location filename="mainwindow.cpp" line="561"/>
<location filename="mainwindow.cpp" line="572"/> <location filename="mainwindow.cpp" line="579"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -299,22 +299,22 @@ kate -l(line) (file)
<translation>&amp;Ohje</translation> <translation>&amp;Ohje</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="201"/> <location filename="mainwindow.cpp" line="202"/>
<source>Select files to check</source> <source>Select files to check</source>
<translation>Valitse tarkistettavat tiedostot</translation> <translation>Valitse tarkistettavat tiedostot</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="210"/> <location filename="mainwindow.cpp" line="211"/>
<source>Select directory to check</source> <source>Select directory to check</source>
<translation>Valitse tarkistettava hakemisto</translation> <translation>Valitse tarkistettava hakemisto</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="240"/>
<source>No suitable files found to check!</source> <source>No suitable files found to check!</source>
<translation>Tarkistettavaksi sopivia tiedostoja ei löytynyt!</translation> <translation>Tarkistettavaksi sopivia tiedostoja ei löytynyt!</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="452"/> <location filename="mainwindow.cpp" line="454"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
@ -323,37 +323,46 @@ Stop the checking before exiting.</source>
Lopeta tarkistus ennen ohjelman sammuttamista.</translation> Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="498"/> <location filename="mainwindow.cpp" line="500"/>
<source>License</source> <source>License</source>
<translation>Lisenssi</translation> <translation>Lisenssi</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Authors</source> <source>Authors</source>
<translation>Tekijät</translation> <translation>Tekijät</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML-tiedostot (*.xml);;Tekstitiedostot (*.txt)</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="515"/> <source>XML files (*.xml);;Text files (*.txt)</source>
<translation type="obsolete">XML-tiedostot (*.xml);;Tekstitiedostot (*.txt)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="517"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation>Tallenna raportti</translation> <translation>Tallenna raportti</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="523"/> <location filename="mainwindow.cpp" line="525"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML-tiedostot (*xml)</translation> <translation>XML-tiedostot (*xml)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="556"/> <location filename="mainwindow.cpp" line="531"/>
<source>Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="563"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="573"/> <location filename="mainwindow.cpp" line="580"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -418,25 +427,25 @@ Lopeta tarkistus ennen ohjelman sammuttamista.</translation>
<name>ResultsTree</name> <name>ResultsTree</name>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>File</source> <source>File</source>
<translation>Tiedosto</translation> <translation>Tiedosto</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Severity</source> <source>Severity</source>
<translation>Tyyppi</translation> <translation>Tyyppi</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Line</source> <source>Line</source>
<translation>Rivi</translation> <translation>Rivi</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Message</source> <source>Message</source>
<translation>Virhe</translation> <translation>Virhe</translation>
</message> </message>
@ -476,22 +485,22 @@ Please check the application path and parameters are correct.</source>
Tarkista että ohjelman polku ja parametrit ovat oikeat.</translation> Tarkista että ohjelman polku ja parametrit ovat oikeat.</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="612"/> <location filename="resultstree.cpp" line="613"/>
<source>all</source> <source>all</source>
<translation>Epävarmat</translation> <translation>Epävarmat</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="616"/> <location filename="resultstree.cpp" line="617"/>
<source>style</source> <source>style</source>
<translation>Tyyli</translation> <translation>Tyyli</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="620"/> <location filename="resultstree.cpp" line="621"/>
<source>security</source> <source>security</source>
<translation>Tietoturva</translation> <translation>Tietoturva</translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="624"/> <location filename="resultstree.cpp" line="625"/>
<source>error</source> <source>error</source>
<translation>Yleinen</translation> <translation>Yleinen</translation>
</message> </message>
@ -499,18 +508,18 @@ Tarkista että ohjelman polku ja parametrit ovat oikeat.</translation>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="77"/> <location filename="resultsview.cpp" line="79"/>
<location filename="resultsview.cpp" line="89"/> <location filename="resultsview.cpp" line="91"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="78"/> <location filename="resultsview.cpp" line="80"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>Virheitä ei löytynyt.</translation> <translation>Virheitä ei löytynyt.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="86"/> <location filename="resultsview.cpp" line="88"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Virheitä löytyi, mutta asetuksissa kyseiset virheet on määritelty piilotettavaksi. <translation>Virheitä löytyi, mutta asetuksissa kyseiset virheet on määritelty piilotettavaksi.

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -118,10 +118,10 @@ kate -l(line) (file)</source>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="238"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="456"/> <location filename="mainwindow.cpp" line="458"/>
<location filename="mainwindow.cpp" line="554"/> <location filename="mainwindow.cpp" line="561"/>
<location filename="mainwindow.cpp" line="572"/> <location filename="mainwindow.cpp" line="579"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -286,59 +286,64 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="201"/> <location filename="mainwindow.cpp" line="202"/>
<source>Select files to check</source> <source>Select files to check</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="210"/> <location filename="mainwindow.cpp" line="211"/>
<source>Select directory to check</source> <source>Select directory to check</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="240"/>
<source>No suitable files found to check!</source> <source>No suitable files found to check!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="452"/> <location filename="mainwindow.cpp" line="454"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="498"/> <location filename="mainwindow.cpp" line="500"/>
<source>License</source> <source>License</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Authors</source> <source>Authors</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="515"/> <location filename="mainwindow.cpp" line="517"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="523"/> <location filename="mainwindow.cpp" line="525"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="556"/> <location filename="mainwindow.cpp" line="531"/>
<source>Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="563"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="573"/> <location filename="mainwindow.cpp" line="580"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -399,25 +404,25 @@ Stop the checking before exiting.</source>
<name>ResultsTree</name> <name>ResultsTree</name>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>File</source> <source>File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Severity</source> <source>Severity</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Line</source> <source>Line</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -455,22 +460,22 @@ Please check the application path and parameters are correct.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="612"/> <location filename="resultstree.cpp" line="613"/>
<source>all</source> <source>all</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="616"/> <location filename="resultstree.cpp" line="617"/>
<source>style</source> <source>style</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="620"/> <location filename="resultstree.cpp" line="621"/>
<source>security</source> <source>security</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="624"/> <location filename="resultstree.cpp" line="625"/>
<source>error</source> <source>error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -478,18 +483,18 @@ Please check the application path and parameters are correct.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="77"/> <location filename="resultsview.cpp" line="79"/>
<location filename="resultsview.cpp" line="89"/> <location filename="resultsview.cpp" line="91"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="78"/> <location filename="resultsview.cpp" line="80"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="86"/> <location filename="resultsview.cpp" line="88"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View File

@ -18,7 +18,7 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message utf8="true">
<location filename="about.ui" line="65"/> <location filename="about.ui" line="65"/>
<source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source> <source>Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -118,10 +118,10 @@ kate -l(line) (file)</source>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="main.ui" line="26"/> <location filename="main.ui" line="26"/>
<location filename="mainwindow.cpp" line="238"/> <location filename="mainwindow.cpp" line="239"/>
<location filename="mainwindow.cpp" line="456"/> <location filename="mainwindow.cpp" line="458"/>
<location filename="mainwindow.cpp" line="554"/> <location filename="mainwindow.cpp" line="561"/>
<location filename="mainwindow.cpp" line="572"/> <location filename="mainwindow.cpp" line="579"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -286,59 +286,64 @@ kate -l(line) (file)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="201"/> <location filename="mainwindow.cpp" line="202"/>
<source>Select files to check</source> <source>Select files to check</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="210"/> <location filename="mainwindow.cpp" line="211"/>
<source>Select directory to check</source> <source>Select directory to check</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="239"/> <location filename="mainwindow.cpp" line="240"/>
<source>No suitable files found to check!</source> <source>No suitable files found to check!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="452"/> <location filename="mainwindow.cpp" line="454"/>
<source>Cannot exit while checking. <source>Cannot exit while checking.
Stop the checking before exiting.</source> Stop the checking before exiting.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="498"/> <location filename="mainwindow.cpp" line="500"/>
<source>License</source> <source>License</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="505"/> <location filename="mainwindow.cpp" line="507"/>
<source>Authors</source> <source>Authors</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="513"/> <location filename="mainwindow.cpp" line="515"/>
<source>XML files (*.xml);;Text files (*.txt)</source> <source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="515"/> <location filename="mainwindow.cpp" line="517"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="523"/> <location filename="mainwindow.cpp" line="525"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="556"/> <location filename="mainwindow.cpp" line="531"/>
<source>Text files (*.txt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="563"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="573"/> <location filename="mainwindow.cpp" line="580"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -399,25 +404,25 @@ Stop the checking before exiting.</source>
<name>ResultsTree</name> <name>ResultsTree</name>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>File</source> <source>File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Severity</source> <source>Severity</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Line</source> <source>Line</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="39"/> <location filename="resultstree.cpp" line="39"/>
<location filename="resultstree.cpp" line="754"/> <location filename="resultstree.cpp" line="755"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -455,22 +460,22 @@ Please check the application path and parameters are correct.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="612"/> <location filename="resultstree.cpp" line="613"/>
<source>all</source> <source>all</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="616"/> <location filename="resultstree.cpp" line="617"/>
<source>style</source> <source>style</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="620"/> <location filename="resultstree.cpp" line="621"/>
<source>security</source> <source>security</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultstree.cpp" line="624"/> <location filename="resultstree.cpp" line="625"/>
<source>error</source> <source>error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -478,18 +483,18 @@ Please check the application path and parameters are correct.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="77"/> <location filename="resultsview.cpp" line="79"/>
<location filename="resultsview.cpp" line="89"/> <location filename="resultsview.cpp" line="91"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="78"/> <location filename="resultsview.cpp" line="80"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="86"/> <location filename="resultsview.cpp" line="88"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

69
gui/csvreport.cpp Normal file
View File

@ -0,0 +1,69 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/
*/
#include <QFile>
#include <QTextStream>
#include "csvreport.h"
CsvReport::CsvReport(const QString &filename, QObject * parent) :
Report(filename, parent)
{
}
CsvReport::~CsvReport()
{
Close();
}
bool CsvReport::Create()
{
bool success = false;
if (Report::Create())
{
mTxtWriter.setDevice(Report::GetFile());
success = true;
}
return success;
}
void CsvReport::WriteHeader()
{
// No header for CSV report
}
void CsvReport::WriteFooter()
{
// No footer for CSV report
}
void CsvReport::WriteError(const QStringList &files, const QStringList &lines,
const QString &id, const QString &severity, const QString &msg)
{
Q_UNUSED(id);
/*
Error as CSV line
gui/test.cpp,23,error,Mismatching allocation and deallocation: k
*/
QString line;
line += QString("%1,%2,").arg(files[files.size() - 1]).arg(lines[lines.size() - 1]);
line += QString("%1,%2").arg(severity).arg(msg);
mTxtWriter << line << endl;
}

72
gui/csvreport.h Normal file
View File

@ -0,0 +1,72 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/
*/
#ifndef CSV_REPORT_H
#define CSV_REPORT_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QTextStream>
#include "report.h"
/**
* @brief CSV text file report.
* This report exports results as CSV (comma separated values). CSV files are
* easy to import to many other programs.
* @todo This class should be inherited from TxtReport?
*/
class CsvReport : public Report
{
public:
CsvReport(const QString &filename, QObject * parent = 0);
~CsvReport();
/**
* @brief Create the report (file).
* @return true if succeeded, false if file could not be created.
*/
virtual bool Create();
/**
* @brief Write report header.
*/
virtual void WriteHeader();
/**
* @brief Write report footer.
*/
virtual void WriteFooter();
/**
* @brief Write error to report.
*/
virtual void WriteError(const QStringList &files, const QStringList &lines,
const QString &id, const QString &severity,
const QString &msg);
private:
/**
* @brief Text stream writer for writing the report in text format.
*/
QTextStream mTxtWriter;
};
#endif // CSV_REPORT_H

View File

@ -45,6 +45,7 @@ HEADERS += mainwindow.h \
txtreport.h \ txtreport.h \
xmlreport.h \ xmlreport.h \
translationhandler.h \ translationhandler.h \
csvreport.h \
../src/checkautovariables.h \ ../src/checkautovariables.h \
../src/checkdangerousfunctions.h \ ../src/checkdangerousfunctions.h \
../src/checkheaders.h \ ../src/checkheaders.h \
@ -85,6 +86,7 @@ SOURCES += main.cpp \
txtreport.cpp \ txtreport.cpp \
xmlreport.cpp \ xmlreport.cpp \
translationhandler.cpp \ translationhandler.cpp \
csvreport.cpp \
../src/checkautovariables.cpp \ ../src/checkautovariables.cpp \
../src/checkdangerousfunctions.cpp \ ../src/checkdangerousfunctions.cpp \
../src/checkmemoryleak.cpp \ ../src/checkmemoryleak.cpp \

View File

@ -31,6 +31,7 @@
#include "threadhandler.h" #include "threadhandler.h"
#include "fileviewdialog.h" #include "fileviewdialog.h"
#include "projectfile.h" #include "projectfile.h"
#include "report.h"
#include "../src/filelister.h" #include "../src/filelister.h"
#include "../src/cppcheckexecutor.h" #include "../src/cppcheckexecutor.h"
@ -511,7 +512,7 @@ void MainWindow::ShowAuthors()
void MainWindow::Save() void MainWindow::Save()
{ {
QString selectedFilter; QString selectedFilter;
QString filter(tr("XML files (*.xml);;Text files (*.txt)")); QString filter(tr("XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
QString selectedFile = QFileDialog::getSaveFileName(this, QString selectedFile = QFileDialog::getSaveFileName(this,
tr("Save the report file"), tr("Save the report file"),
QString(), QString(),
@ -520,22 +521,27 @@ void MainWindow::Save()
if (!selectedFile.isEmpty()) if (!selectedFile.isEmpty())
{ {
//Check if xml file type was selected Report::Type type;
bool xml = selectedFilter == tr("XML files (*.xml)"); if (selectedFilter == tr("XML files (*.xml)"))
//Force xml extension to the file
if (xml && !selectedFile.endsWith(".xml", Qt::CaseInsensitive))
{ {
type = Report::XML;
if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive))
selectedFile += ".xml"; selectedFile += ".xml";
} }
else if (selectedFilter == tr("Text files (*.txt)"))
//Force .txt extension
if (!xml && !selectedFile.endsWith(".txt", Qt::CaseInsensitive))
{ {
type = Report::TXT;
if (!selectedFile.endsWith(".txt", Qt::CaseInsensitive))
selectedFile += ".txt"; selectedFile += ".txt";
} }
else
{
type = Report::CSV;
if (!selectedFile.endsWith(".csv", Qt::CaseInsensitive))
selectedFile += ".csv";
}
mUI.mResults->Save(selectedFile, xml); mUI.mResults->Save(selectedFile, type);
} }
} }

View File

@ -30,6 +30,14 @@
class Report : public QObject class Report : public QObject
{ {
public: public:
enum Type
{
TXT,
XML,
CSV,
};
Report(const QString &filename, QObject * parent = 0); Report(const QString &filename, QObject * parent = 0);
virtual ~Report(); virtual ~Report();

View File

@ -21,8 +21,10 @@
#include <QFile> #include <QFile>
#include <QMessageBox> #include <QMessageBox>
#include "resultsview.h" #include "resultsview.h"
#include "report.h"
#include "txtreport.h" #include "txtreport.h"
#include "xmlreport.h" #include "xmlreport.h"
#include "csvreport.h"
ResultsView::ResultsView(QWidget * parent) : ResultsView::ResultsView(QWidget * parent) :
QWidget(parent), QWidget(parent),
@ -129,7 +131,7 @@ void ResultsView::ExpandAllResults()
mUI.mTree->expandAll(); mUI.mTree->expandAll();
} }
void ResultsView::Save(const QString &filename, bool xml) void ResultsView::Save(const QString &filename, Report::Type type)
{ {
if (!mErrorsFound) if (!mErrorsFound)
{ {
@ -138,11 +140,25 @@ void ResultsView::Save(const QString &filename, bool xml)
msgBox.exec(); msgBox.exec();
} }
if (xml) Report *report = NULL;
switch (type)
{ {
XmlReport report(filename); case Report::CSV:
if (report.Create()) report = new CsvReport(filename, this);
mUI.mTree->SaveResults(&report); break;
case Report::TXT:
report = new TxtReport(filename, this);
break;
case Report::XML:
report = new XmlReport(filename, this);
break;
}
if (report)
{
if (report->Create())
mUI.mTree->SaveResults(report);
else else
{ {
QMessageBox msgBox; QMessageBox msgBox;
@ -151,18 +167,12 @@ void ResultsView::Save(const QString &filename, bool xml)
} }
} }
else else
{
TxtReport report(filename);
if (report.Create())
mUI.mTree->SaveResults(&report);
else
{ {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText("Failed to save the report."); msgBox.setText("Failed to save the report.");
msgBox.exec(); msgBox.exec();
} }
} }
}
void ResultsView::UpdateSettings(bool showFullPath, void ResultsView::UpdateSettings(bool showFullPath,
bool saveFullPath, bool saveFullPath,

View File

@ -26,6 +26,7 @@
#include "../src/errorlogger.h" #include "../src/errorlogger.h"
#include "resultstree.h" #include "resultstree.h"
#include "common.h" #include "common.h"
#include "report.h"
#include "ui_resultsview.h" #include "ui_resultsview.h"
/** /**
@ -60,9 +61,9 @@ public:
* @brief Save results to a file * @brief Save results to a file
* *
* @param filename Filename to save results to * @param filename Filename to save results to
* @param xml should results be saved as xml (true) or txt (false) * @param type Type of the report.
*/ */
void Save(const QString &filename, bool xml); void Save(const QString &filename, Report::Type type);
/** /**
* @brief Update tree settings * @brief Update tree settings