Setting organization and program name in main() allows us to
cleanup Settings class usage. As we don't need to keep using the
one instance of Settings but can create new Settings class
whenever we need to access settings. According to the Qt
documentation creating Settings class is fast.
Use project file's location as base path when adding new paths
(checked, included or ignored) to the project. In most cases user
wants to add paths in the same project so this reduces browsing
paths considerably when adding them.
When project files support was added to the GUI there was no GUI
for them and automatic/silent loading was added. So that if the
directory contained project file with the same name (and .cppcheck
extension) then the project file was automatically loaded and used
for the checking.
This can be very confusing for the user as there is no any
indication that the project file is used. But this solution was
necessary at that time to get project file support added.
Now that we have usable GUI for the project files this automatic/
silent loading can be removed. Nobody really should be using it
anymore. And even if the automatic loading is needed one can give
the project file for the GUI using command line parameter.
The project file to check just GUI code was missing the directory
to check. This is probably due it was used originally as
"automatically" loaded project file which assumed current
directory is checked and only added some additional parameters.
If the project file in MRU list does not exist ask user if one
wants to remove the file from the list. If user agrees then the
file is removed from the list. Otherwise the file is left to the
list but not tried to open. User may have accidentally moved or
renamed the file so we give a possibility to add it back and not
just blindly removing it from the list.
Add MRU items for project files to File-menu. When user creates
a new project file or opens existing project file it is added to
the list of recently used projects. Last 5 projects are remembered
and available for quick acess in the File-menu.
The ErrorLogger::reportStatus() is not lib code interface. The CLI
code does the looping through file list and gives one file at a
time for the core code. Hence lib has no any idea about the
progress and it can't provide such information.
Also the recent commit (6d858b6) caused a GUI build failure by
adding CLI code dependency to GUI. Which is big no-no.
This is admittedly a hack. But it allow us to build all modules
again.
Two Qt modules are not needed any more in the CMake script for the graphical
user interface after the commit "GUI: Open online-help instead of local help".
3965a08b7b (commit)
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Unify usage and API of CppCheck class. Allow only one file checked
at a time, instead of list of files. Clients can then handle file
lists more naturally and as they see fit. Also clients have better
knowledge of how checking status should be handled.
The single-threaded CLI checking was only one using the file list.
Other clients were giving files (to list) one file at a time.
Add new "Advanced" page to preferences-dialog and add there a
checkbox for enabling inconclusive checks. Now that checkbox is
the only control in that new page but there will be more controls
later on.
This is the first (and quick) support for the inconclusive errors.
We simply add [Inconclusive] to begin of the summary. This is
temporary solution until better GUI is implemented. XML v1 won't
be supporting inconclusive errors. For XML v2 we need still to
decide what to do.
GUI now recognizes -p <project file> command line parameter. When
given (with path to valid project file) GUI automatically loads
the project file and starts checking paths in it.
Ticket: #2613 (GUI: Should accept project file from command line)
I earlier added a check for missing (editor) application command
line parameters. If parameters are missing at GUI startup an
message is shown to user to check the settings. Unfortunately
my check was incomplete and it also triggered when there was no
applications defined. Which happens when user starts GUI for a
first time.
Fix the check so that user is only informed in case the parameters
are missing and name + path are set.
In GNOME the whole big text area was not shown without making the
dialog bigger. So improve the layout for better scaling and adjust
dialog size when it gets initialized.
Earlier user had to add quotation marks around application executable
path in application dialog. Because we could not determine which part
is path and which part is parameters. As we now have separate
variables we can automatically add the quotation marks when needed
before starting the application. This reduces the confusion users
have had about the correct formatting of paths.
Currently combined editor application path + params is a bit
problematic (at least in Windows). We really don't know where the app
path ends and parameters start. So proper quoting is not always
possible.
And application path and command line parameters are clearly
different settings anyway. So make them separate settings. It has
bunch of other positive sides too. Like one can now browse new path
for the application without loosing the parameters.
When starting Cppcheck version with these new settings user is warned
that loading settings had problems and asked to check and fix the
settings.
The library "htmlhelp" is not needed by the graphical user interface at the moment.
2fea5f01d6 (gui)/gui.pro
There are difficulties to fulfil this dependency.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
The executable file for the graphical user interface was renamed in a CMake
script to synchronise this setting with the qmake build specification.
b88ce77e4a (gui)/gui.pro
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Local help does not currently work (ticket #2316) and building it
is a bit painful in Windows. Hence it was decided on ticket #2677
and at IRC that we open on-line help from GUI until the local
help issue is solved.
Ln pointed out in IRC that 'se' is not ISO-639 name of the Swedish,
but 'sv' is. So rename the translation file to use the correct
ISO-639 name. This wrong name also probably caused the GUI not
recognizing Swedish locale of the OS.
Translation of severity texts was temporarily disabled by earlier
commits. Now adding new method to ResultsTree for getting
translated severity string.
Convert from using string to enum values for severity in ErrorItem.
Storing and handling severity as string was the easy way earlier
but it is not convenient or efficient way to handle severities.
This commit is the first step in converting severity handling to
use the enum values instead of strings.
Show native path separators in project file-dialog. Convert paths
to internal separators when reading from project file and when
reading from the dialog. Convert to native separators when adding
to the dialog (for the user).
Add similar GUI than include paths has. Currently there is only
possibly select directories directly from the GUI. But filename
can be added to the path by editing it.
Add applying of filtering into list of files to check if we have
an active project file. Filtering is quite much similar to the
filtering in CLI.
If we have directory filter ("gui/") then we check all paths if
they contain "gui" part. In practice we search for string "/gui"
from the paths. If we have filename filtering
("gui/projectfile.cpp") then we check if any of the paths end
with that.
This patch adds support for ignored paths in the project file.
There is new <ignore> element which can contain one or more
<path> elements with name attribute containing the path to
ignore.
Handling paths in line edit control is quite hard. List control is
much more pleasant to use for it. Convert Project file path
handling to similar list control usage than include paths earlier.
Editing include directories in edit control is not nice. Instead
add new tab and list control for the include directories. They
are now added, edited and removed like global include directories
in settings dialog.
The default application was not handled correctly when removing
application from the list. If the default application is removed
then we reset the default application to unknown. Otherwise we
make sure the default application is correct after the removal of
other application.
Instead of keeping the default application as a first item in
the application list point the default application by adding a
"[Default]" text after its name.
Make the editor application settings dialog to look similar than
include paths dialog. Move buttons right to the list, not below.
And remove unnecessary "application" word from button texts.
Rename Modify-button to Edit-button since we are not modifying
the application but editing its info. Similarly rename Delete-
button to Remove-button since we are not deleting the application
but removing from the list.
Instead of hard-to-use single line edit control, use list control
for include paths. Have separate buttons for adding, editing and
removing paths. Paths are still stored as one string where paths
are separated with ";". Empty paths are ignored.
If there were unknown language in settings the fallback to English
language didn't work as expected. And there were no proper current
language set after that. Initialize current language to English
so we always have English as proper fallback.
GUI was storing selected language as index to the languages list.
This is fragile since the order and count of items can change.
This commit changes to using ISO language code (e.g. "en" for
"English").
Fixes ticket #2446 (GUI: Don't use index number for language selection)
Instead of separate language name and filename lists use one
list of structs. This makes language name and filename more
connected and makes handling of them easier.
XML report format 1 only had error "lines" that we promoted to "items"
when adding to GUI. XML report format 2 contains error "items" so
change the code to read items and do the promotion directly when
reading and parsing the data.
The current wording was confusing (espcially related to CLI) since
it said the option will make Cppcheck to check all #ifdef configs.
But this really is case only when there is excessive amount of
those configs and without the option some would be ignored. So
format the option text in line of CLI switch and say it is forcing
not enabling checking of all configurations.
When reading XML file there is no summary data stored so we must
dublicate the message data to summary. Since message can be long
try to find full stop from the message and cut summary to it.
Ticket: #2402 ([GUI] Summary is not shown for loaded .xml file)
Ticket #2513 (GUI: Garbage printed to log after missing include warning)
The linenumber was not properly converted to the QString so there
were garbage printed to the log.
Settings-dialog is more natural place for language selection than
the main menu. We also have more space and freedom there to have
longer text etc to make the selection easier (menus are quite limited
controls).
Ticket #2424 (Windows GUI: "Copy full path" doesn't copy the visible full path if it has been changed in preferences)
We keep paths internally with / separator and only convert to native
separators (for Windows) when showing them. Conversion was missing
from path copying function.
Dan added new enable-flag for information messages in commit 033e759.
Enable that flag for GUI so that the information messages are visible
in the GUI.
I accidentally added the 'placeholderText' attribute to settings.ui
when editing it with Qt Creator. That attribute was added in Qt
4.7.0 and we are not using it for anything. So removing it to fix
building with older Qt versions.
Add 'backend' support for the new 'portability' severity. The new
severity is handled, converted to new SHOW_PORTABILITY and added
with correct type to the result view.
There is no menuitem/toolbar button to show/hide portability
items. Likewise there is no line for portability issues in stats-
dialog.
Ticket #2106 (More severities and new xml format)
Show both short summary and verbose message in lower details panel
in the GUI: Add titles for short summary and message. Hopefully this
makes it easier to read the messages and copy/paste them too.
Revert change ca9f8a7036 that converted
text in Add Application -dialog to rich text. The text is plain
text and doesn't use any formatting so plain text is good for it.
This commit adds new setting and GUI for global include dirs. When
project file with include dirs is loaded, global includes dirs are
added first and after them the include dirs from project file.
After previous patches the details view was only updated when the
item was clicked with mouse. This patch improves the updating and
now it works also when changing selected item using keyboard.
This commit adds new rich text panel for the detailed error messages.
When user clicks error item the detailed error text is updated to
the panel. This way we have much more freedom in formatting the
message and user can easily copy/paste (parts of) the message.
Get rid of the form layout stretching the Browse-button so wide. Use
form-like but more flexible layout. Change the term 'Application to
execute' to 'Command to execute'. This reduces duplication and makes
clear difference between application name and the command to execute
to start the application. Fix also tab ordering so that the
application name field gets the focus initially.
Now DebugErrors get correctly routed to check log. The wrong slot
name also caused a warning printed to the console as reported by
thevbm in ticket #2006.
Debug errors were not shown anywhere in the GUI, they were just
ignored. This commit adds new signal for those debug errors and
directs them to checking log.
Solves ticket #1898 (GUI: Handle internal errors from lib)
* moved the help file to the application folder
* use absolute path instead of relative path for helpfile
* show warning messages if help file doesn't exist or fails to be loaded
Project closing action was not enabled when the project file was
opened from the checked directory. Also update the window caption to
contain project file name that was opened from the checked
directory.
The GUI was crashing if no project files were in checked directory.
I missed this case in my own testing because I had created test
project files for each directory. Whoops!
Anyway, this now also makes silently loaded project files (project
file residing in directory but not load by the user) as normal
projects in the GUI.
If rootpath is given in project file then use it as a current
directory. Also check if paths given in project file are
relative and use rootpath as base path for relative paths.
Add support for new root-element to project file. This element
defines project root directory if given. If not given then project
root is directory where the project file is located.
Now we load user-selected project file and start checking paths it
contains. Project file can be anywhere as long as it contains valid
path(s) to check.
Add new element containing paths to check into the project file. This
is for growing project files to real project files that can be loaded
and selected from the GUI. And decoupling project files from the
directory they reside. So you can put project file in any directory,
load it and it checks paths listed.
I accidentally committed two new files with filenames starting
with capital letters from Windows machine. The Linux build
breakage was fixed by fixing the include lines. But the correct
fix is to fix filenames as we are using all lower letter filenames
in this project.
Create a list of files to check. Currently we only read this list
once. But later on we can refer to this list to for example
determine which files were checked and which not in aborted
checking.
The _CRT_SECURE_NO_WARNINGS define suppresses some Windows-specific
compile warnings. Windows has "secure" versions of some functions
and compiler outputs warnings that those "secure" versions should
be used instead. Since other platforms don't have those functions
we just suppress this warning for now on.
Current directory was set from first file in the list. That file
could be in subdirectory when wrong path was set. Also getting
absolute path was buggy.
Current directory was set from first file in the list. That file
could be in subdirectory when wrong path was set. Also getting
absolute path was buggy.
Earlier commit allowed cppcheck to exit immediately while checking.
This however leads crashes and error logs shown since the thread
termination leaves things in inconsistent state. I thought cppcheck
would close fast enough so these could be ignored. But apparently
not.
So this commits adds new bool mExiting for MainWindow and sets that
to true when exiting while checking. When the checking is ready this
attribute is checked and if it is true the application can now be
cleanly exited.
At first we created the GUI in the code and so needed all the layouts
etc include to the code. Now when we are using UI files we don't need
all those included. So clean them up. Also use forward declarations
instead of includes in header files when possible.
Ensure that native separators are used in saved reports. Reports may
be parsed by other programs/scripts so it is important that paths
are properly formatted.
GUI used to show paths with / separator which is not native
separator in Windows. So lets convert shown paths to native
separators before adding them to the GUI.
This commit modifies and registers ErrorItem as proper metatype so it
can be used with Qt signals. Then sending Error-signals is refactored
so that ErrorItem instances are sent instead of several different
arguments that already contained couple of lists.