The GUI crashed if the project file was tried to open from the
command line. The project file loading was run before the MRU menu
was created but tried to add a new item to it.
Project file can't be opened when the check is running. So the menu
items must be disabled.
Fixes ticket: #3446 (GUI: MRU items must be disabled while checking)
We are using ShowTypes around the GUI codebase so it makes sense
to have it in its own class. And the class also contains related
helper functions instead of scattering them around different
classes.
ShowTypes also contains the visibility settings for all the
GUI severities. Implementation in this commit makes ShowTypes
class to load the visibility settings when it is created. And save
the settings when it is destroyed.
When GUI was started not all the categories visibility statuses
were not preserved. I.e.
Ticket: #3087 (GUI does not show all reported files until a filter button state is changed)
When running in Windows platforms, set the GUI's checked platform
initially to Windows 32-bit ANSI. Other platforms are set
initially to default/unspecified which means the type sizes are
from the platform GUI was compiled on.
This was suggested by Rober in ticket #3119.
We have now one list for checked platforms, menu items are created
dynamically based on that list. This makes it much easier to alter
the platforms list later on.
This is quick and dirty patch to add the platform selection for
the GUI. It is simple menu selection in Check-menu. It always
defaults to "Default" at startup. And it forget the selection
when the application is closed.
Ticket: #3119 (GUI: add ability to specify platform type)
The CLI/LIB change earlier added own enable-flag for performance-
and portability-checks. This commit updates GUI to also enable
those new enable-flags.
Per project include directories must be added to the list before
the global include directories. Include directories are searched
in listed order. So placing per project include directories first
we ensure per project include file is found instead of the global
include file if same file exist in both.
The extra menu separator was added before the MRU menu items. When
updating the (menu) MRU items existing items were first removed
and new items added back. But the added separator was not removed.
Earlier the GUI (project) went into some weird state after creating
a new project. The project could not be checked in any discoverable
way.
This commit fixes the above bug by automatically checking the new
project after the project dialog is closed. I think this is what
most users expect to happen.
Exclude is the correct term to use when removing paths from the
list of checked items. Ignore as a term was a poor choise to begin
with. XML file reading still recognizes and reads the 'ignore'
element but writes 'exclude' element.
Ticket: #2995 (GUI: Rename ignore-feature to exclude-feature)
If the "extra version" is defined (not empty) then it is shown
after the actual version number in the About-dialog.
Ticket: #2164 ([GUI] Add revision info to "About" window)
When Filter-toolbar was enabled/disabled from the View-menu its
state was not updated to the context menu. And vice versa.
Ticket: #2923 (GUI: Filter toolbar menu items not synchronized)
Fix I did yesterday gave only filename of the project file for
function loading project file. Causing the loading failing if
not in "current" directory.
If we there is project file in the directory to check then ask
user if one wants to use the project file instead. If there are
multiple project files then just tell there are project files
and ask if user wants to continue without using them.
Ticket: #2816 (GUI regression: Interrupted checking because of too many #ifdef configurations.)
If the project file does not define paths to check then check the
project root directory (which likely is the directory where the
project file is located).
Ticket #2816 (GUI regression: Interrupted checking because of too many #ifdef configurations.)
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.
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.
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.
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)
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.
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.
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.
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)
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).
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.
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.
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.
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.
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.
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.
This commit separates logic more from the GUI. The dialog class is
only responsible from showing the dialog and handling data in it.
Other related classes do the project file reading/saving/etc.
This commits adds new "Open XML" item to File-menu. Selecting this
menuitem allows user to select report file to open. When the file is
read the error data is printed to debug output. Later patches will
implement adding error data back to the GUI.
Add new "New project file" item to File-menu and rename existing
"Project File" item to "Open Project File". Selecting new file
opens empty project file dialog. When the dialog is then closed
the user is asked to select a filename for the new project file.
Progress signal had also item count with it and then the handler determined
that check is ready when max count of progress was done. Also progressbar
was practically reset in every progress signal. This was simply fragile
code.
After this patch progress signal has only the current progress count. Total
count of items is given when initializing the checking. And there is
separate function for handling check finishing.
This also fixes the bug that progressbar was not hidden after checking
or when interrupting the checking.
Improve the system used to have separate versions of code of FileLister for
Win32 and Linux. New idea is to have Base FileLister class implementing
common code and then derived classes for Win32 and Linux specific code.
FileLister is not anymore a static class. Instead we use singleton of
derived class.
Fixes ticket #436 (GUI: All style -severity). The possible style errors can be now selected visible / hidden so all severities have their own menu item.
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 enables us to check if toolbar is visible or not. Earlier
we saved settings after the window was closed and checking for
toolbar visibility was not feasible anymore.
Also added QSetting value names to common.h
Work is halfway on both translations and .ui files.
I added a very quick and rough finnish translation.
The program now requires the translation files to be created before running
that can be done with lrelease gui.pro.
To compile the whole GUI one must do the following
cd gui
qmake
lrelease gui.pro
make
Having translated settings names is a bad idea. If user changes GUI language one loses settings. Also settings might be exported/imported and translated names might not work between systems/users.
GUI reads per-project settings (automatically deallocated classes) from XML project file. The project file format is described in projectfile.txt. Example project file is added for gui.
See also forum discussion at:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=46
Add "Authors" and "License" items to the Help-menu. When selected, these items open simple text file viewer dialog. The AUTHORS and COPYING files are embedded to the executable and shown in the dialog.
One for when user tries to double click and there are now applications specified.
Another for when user tries to check something and the file list is empty.
Threads must be exited from check cleanly even though it takes small amount of time. Just terminating thread can have unpredictable side-effects (even weird crashes).
The number of threads is now atleast 1.
Added a very simple about dialog with version number and license.
Replaced all CppCheck's with Cppcheck.
Renamed "show more errors" to "show possible false positives" in the menu.
User created application now has to have a name and a path.
Items are now hidden from the tree and the tree is not recreated everytime it is refreshed.
Also added test.cpp as a sample data for GUI testing.
Added Check all and uncheck all buttons to menu to show/hide all errors more easily.