GUI: Formatting comments

This commit is contained in:
Daniel Marjamäki 2016-10-02 18:23:51 +02:00
parent 0e78dd5eac
commit 143e7bf8b1
1 changed files with 161 additions and 309 deletions

View File

@ -42,16 +42,16 @@ class QAction;
/// @{ /// @{
/** /**
* @brief Main window for cppcheck-gui * @brief Main window for cppcheck-gui
* *
*/ */
class MainWindow : public QMainWindow { class MainWindow : public QMainWindow {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief Maximum number of MRU project items in File-menu. * @brief Maximum number of MRU project items in File-menu.
*/ */
enum { MaxRecentProjects = 5 }; enum { MaxRecentProjects = 5 };
MainWindow(TranslationHandler* th, QSettings* settings); MainWindow(TranslationHandler* th, QSettings* settings);
@ -63,273 +63,174 @@ public:
Platforms mPlatforms; Platforms mPlatforms;
/** /**
* @brief Checks given code * @brief Checks given code
* *
* @param code Content of the (virtual) file to be checked * @param code Content of the (virtual) file to be checked
* @param filename Name of the (virtual) file to be checked - determines language. * @param filename Name of the (virtual) file to be checked - determines language.
*/ */
void CheckCode(const QString& code, const QString& filename); void CheckCode(const QString& code, const QString& filename);
public slots: public slots:
/** /** @brief Slot for check files menu item */
* @brief Slot for check files menu item
*
*/
void CheckFiles(); void CheckFiles();
/** /** @brief Slot to recheck all files */
* @brief Slot to recheck all files
*
*/
void ReCheckAll(); void ReCheckAll();
/** /**
* @brief Slot to recheck selected files * @brief Slot to recheck selected files
* @param selectedFilesList list of selected files * @param selectedFilesList list of selected files
*/ */
void PerformSelectedFilesCheck(QStringList selectedFilesList); void PerformSelectedFilesCheck(QStringList selectedFilesList);
/** /** @brief Slot to recheck modified files */
* @brief Slot to recheck modified files
*
*/
void ReCheckModified(); void ReCheckModified();
/** /** @brief Slot to clear all search results */
* @brief Slot to clear all search results
*
*/
void ClearResults(); void ClearResults();
/** /** @brief Slot to open XML report file */
* @brief Slot to open XML report file
*
*/
void OpenResults(); void OpenResults();
/** /**
* @brief Show errors with type "style" * @brief Show errors with type "style"
* @param checked Should errors be shown (true) or hidden (false) * @param checked Should errors be shown (true) or hidden (false)
*/ */
void ShowStyle(bool checked); void ShowStyle(bool checked);
/** /**
* @brief Show errors with type "error" * @brief Show errors with type "error"
* @param checked Should errors be shown (true) or hidden (false) * @param checked Should errors be shown (true) or hidden (false)
*/ */
void ShowErrors(bool checked); void ShowErrors(bool checked);
/** /**
* @brief Show errors with type "warning" * @brief Show errors with type "warning"
* @param checked Should errors be shown (true) or hidden (false) * @param checked Should errors be shown (true) or hidden (false)
*/ */
void ShowWarnings(bool checked); void ShowWarnings(bool checked);
/** /**
* @brief Show errors with type "portability" * @brief Show errors with type "portability"
* @param checked Should errors be shown (true) or hidden (false) * @param checked Should errors be shown (true) or hidden (false)
*/ */
void ShowPortability(bool checked); void ShowPortability(bool checked);
/** /**
* @brief Show errors with type "performance" * @brief Show errors with type "performance"
* @param checked Should errors be shown (true) or hidden (false) * @param checked Should errors be shown (true) or hidden (false)
*/ */
void ShowPerformance(bool checked); void ShowPerformance(bool checked);
/** /**
* @brief Show errors with type "information" * @brief Show errors with type "information"
* @param checked Should errors be shown (true) or hidden (false) * @param checked Should errors be shown (true) or hidden (false)
*/ */
void ShowInformation(bool checked); void ShowInformation(bool checked);
/** /** @brief Slot to check all "Show errors" menu items */
* @brief Slot to check all "Show errors" menu items
*/
void CheckAll(); void CheckAll();
/** /** @brief Slot to uncheck all "Show errors" menu items */
* @brief Slot to uncheck all "Show errors" menu items
*/
void UncheckAll(); void UncheckAll();
/** /** @brief Slot for check directory menu item */
* @brief Slot for check directory menu item
*
*/
void CheckDirectory(); void CheckDirectory();
/** /** @brief Slot to open program's settings dialog */
* @brief Slot to open program's settings dialog
*
*/
void ProgramSettings(); void ProgramSettings();
/** /** @brief Slot to open program's about dialog */
* @brief Slot to open program's about dialog
*
*/
void About(); void About();
/** /** @brief Slot to to show license text */
* @brief Slot to to show license text
*
*/
void ShowLicense(); void ShowLicense();
/** /** @brief Slot to to show authors list */
* @brief Slot to to show authors list
*
*/
void ShowAuthors(); void ShowAuthors();
/** /** @brief Slot to save results */
* @brief Slot to stop processing files
*
*/
void Save(); void Save();
/** /** @brief Slot to create new project file */
* @brief Slot to create new project file
*
*/
void NewProjectFile(); void NewProjectFile();
/** /** @brief Slot to open project file and start checking contained paths. */
* @brief Slot to open project file and start checking contained paths.
*
*/
void OpenProjectFile(); void OpenProjectFile();
/** /** @brief Slot to show scratchpad. */
* @brief Slot to open project file and start checking contained paths.
*
*/
void ShowScratchpad(); void ShowScratchpad();
/** /** @brief Slot to close open project file. */
* @brief Slot to close open project file.
*
*/
void CloseProjectFile(); void CloseProjectFile();
/** /** @brief Slot to edit project file. */
* @brief Slot to edit project file.
*
*/
void EditProjectFile(); void EditProjectFile();
/** /** @brief Slot for showing the log view. */
* @brief Slot for showing the log view.
*
*/
void ShowLogView(); void ShowLogView();
/** /** @brief Slot for showing the scan and project statistics. */
* @brief Slot for showing the scan and project statistics.
*
*/
void ShowStatistics(); void ShowStatistics();
/** /** @brief Slot for showing the library editor */
* @brief Slot for showing the library editor
*
*/
void ShowLibraryEditor(); void ShowLibraryEditor();
protected slots: protected slots:
/** /** @brief Slot for checkthread's done signal */
* @brief Slot for checkthread's done signal
*
*/
void CheckDone(); void CheckDone();
/** /** @brief Lock down UI while checking */
* @brief Lock down UI while checking
*
*/
void CheckLockDownUI(); void CheckLockDownUI();
/** /** @brief Slot for enabling save and clear button */
* @brief Slot for enabling save and clear button
*
*/
void ResultsAdded(); void ResultsAdded();
/** /** @brief Slot for showing/hiding standard toolbar */
* @brief Slot for showing/hiding standard toolbar
*/
void ToggleMainToolBar(); void ToggleMainToolBar();
/** /** @brief Slot for showing/hiding Categories toolbar */
* @brief Slot for showing/hiding Categories toolbar
*/
void ToggleViewToolBar(); void ToggleViewToolBar();
/** /** @brief Slot for showing/hiding Filter toolbar */
* @brief Slot for showing/hiding Filter toolbar
*/
void ToggleFilterToolBar(); void ToggleFilterToolBar();
/** /** @brief Slot for updating View-menu before it is shown. */
* @brief Slot for updating View-menu before it is shown.
*/
void AboutToShowViewMenu(); void AboutToShowViewMenu();
/** /** @brief Slot when stop checking button is pressed */
* @brief Slot when stop checking button is pressed
*
*/
void StopChecking(); void StopChecking();
/** /** @brief Open help file contents */
* @brief Open help file contents
*
*/
void OpenHelpContents(); void OpenHelpContents();
/** /** @brief Add new line to log. */
* @brief Add new line to log.
*
*/
void Log(const QString &logline); void Log(const QString &logline);
/** /** @brief Handle new debug error. */
* @brief Handle new debug error.
*
*/
void DebugError(const ErrorItem &item); void DebugError(const ErrorItem &item);
/** /** @brief Filters the results in the result list. */
* @brief Filters the results in the result list.
*/
void FilterResults(); void FilterResults();
/** /** @brief Opens recently opened project file. */
* @brief Opens recently opened project file.
*/
void OpenRecentProject(); void OpenRecentProject();
/** /** @brief Selects the platform as checked platform. */
* @brief Selects the platform as checked platform.
*/
void SelectPlatform(); void SelectPlatform();
private: private:
/** /** @brief Rechecks files */
* @brief Rechecks files
*
*/
void ReCheck(bool all); void ReCheck(bool all);
/** /**
* @brief Recheck selected files * @brief Recheck selected files
* @param files list of selected files * @param files list of selected files
* @param all true if all files of list, false if modified files of list * @param all true if all files of list, false if modified files of list
*/ */
void ReCheckSelected(QStringList files, bool all); void ReCheckSelected(QStringList files, bool all);
/** /**
@ -339,127 +240,113 @@ private:
void CheckProject(Project *project); void CheckProject(Project *project);
/** /**
* @brief Set current language * @brief Set current language
* @param code Language code of the language to set (e.g. "en"). * @param code Language code of the language to set (e.g. "en").
*/ */
void SetLanguage(const QString &code); void SetLanguage(const QString &code);
/** /** @brief Event coming when application is about to close. */
* @brief Event coming when application is about to close.
*/
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);
/** /**
* @brief Helper function to toggle all show error menu items * @brief Helper function to toggle all show error menu items
* @param checked Should all errors be shown (true) or hidden (false) * @param checked Should all errors be shown (true) or hidden (false)
*/ */
void ToggleAllChecked(bool checked); void ToggleAllChecked(bool checked);
/** /** @brief Helper function to enable/disable all check,recheck buttons */
* @brief Helper function to enable/disable all check,recheck buttons
*
*/
void EnableCheckButtons(bool enable); void EnableCheckButtons(bool enable);
/** /**
* @brief Select files/or directory to check. * @brief Select files/or directory to check.
* Helper function to open a dialog to ask user to select files or * Helper function to open a dialog to ask user to select files or
* directory to check. Use native dialogs instead of Qt:s own dialogs. * directory to check. Use native dialogs instead of Qt:s own dialogs.
* *
* @param mode Dialog open mode (files or directories) * @param mode Dialog open mode (files or directories)
* @return QStringList of files or directories that were selected to check * @return QStringList of files or directories that were selected to check
*/ */
QStringList SelectFilesToCheck(QFileDialog::FileMode mode); QStringList SelectFilesToCheck(QFileDialog::FileMode mode);
/** /**
* @brief Check project * @brief Check project
* * @param p imported project
* @param p imported project */
*/
void DoCheckProject(ImportProject p); void DoCheckProject(ImportProject p);
/** /**
* @brief Check all files specified in parameter files * @brief Check all files specified in parameter files
* *
* @param files List of files and/or directories to check * @param files List of files and/or directories to check
*/ */
void DoCheckFiles(const QStringList &files); void DoCheckFiles(const QStringList &files);
/** /**
* @brief Get our default cppcheck settings and read project file. * @brief Get our default cppcheck settings and read project file.
* *
* @return Default cppcheck settings * @return Default cppcheck settings
*/ */
Settings GetCppcheckSettings(); Settings GetCppcheckSettings();
/** /** @brief Load program settings */
* @brief Load program settings
*
*/
void LoadSettings(); void LoadSettings();
/** /** @brief Save program settings */
* @brief Save program settings
*
*/
void SaveSettings() const; void SaveSettings() const;
/** /**
* @brief Format main window title. * @brief Format main window title.
* @param text Text added to end of the title. * @param text Text added to end of the title.
*/ */
void FormatAndSetTitle(const QString &text = QString()); void FormatAndSetTitle(const QString &text = QString());
/** /** @brief Show help contents */
* @brief Show help contents
*/
void OpenOnlineHelp(); void OpenOnlineHelp();
/** /**
* @brief Enable or disable project file actions. * @brief Enable or disable project file actions.
* Project editing and closing actions should be only enabled when project is * Project editing and closing actions should be only enabled when project is
* open and we are not checking files. * open and we are not checking files.
* @param enable If true then actions are enabled. * @param enable If true then actions are enabled.
*/ */
void EnableProjectActions(bool enable); void EnableProjectActions(bool enable);
/** /**
* @brief Enable or disable project file actions. * @brief Enable or disable project file actions.
* Project opening and creating actions should be disabled when checking. * Project opening and creating actions should be disabled when checking.
* @param enable If true then actions are enabled. * @param enable If true then actions are enabled.
*/ */
void EnableProjectOpenActions(bool enable); void EnableProjectOpenActions(bool enable);
/** /**
* @brief Add include directories. * @brief Add include directories.
* @param includeDirs List of include directories to add. * @param includeDirs List of include directories to add.
* @param result Settings class where include directories are added. * @param result Settings class where include directories are added.
*/ */
void AddIncludeDirs(const QStringList &includeDirs, Settings &result); void AddIncludeDirs(const QStringList &includeDirs, Settings &result);
/** /**
* @brief Handle command line parameters given to GUI. * @brief Handle command line parameters given to GUI.
* @param params List of string given to command line. * @param params List of string given to command line.
*/ */
void HandleCLIParams(const QStringList &params); void HandleCLIParams(const QStringList &params);
/** /**
* @brief Load XML file to the GUI. * @brief Load XML file to the GUI.
* @param file Filename (inc. path) of XML file to load. * @param file Filename (inc. path) of XML file to load.
*/ */
void LoadResults(const QString file); void LoadResults(const QString file);
/** /**
* @brief Load XML file to the GUI. * @brief Load XML file to the GUI.
* @param file Filename (inc. path) of XML file to load. * @param file Filename (inc. path) of XML file to load.
* @param checkedDirectory Path to the directory that the results were generated for. * @param checkedDirectory Path to the directory that the results were generated for.
*/ */
void LoadResults(const QString file, const QString checkedDirectory); void LoadResults(const QString file, const QString checkedDirectory);
/** /**
* @brief Load project file to the GUI. * @brief Load project file to the GUI.
* @param filePath Filename (inc. path) of project file to load. * @param filePath Filename (inc. path) of project file to load.
*/ */
void LoadProjectFile(const QString &filePath); void LoadProjectFile(const QString &filePath);
/** /**
@ -471,115 +358,80 @@ private:
Library::Error LoadLibrary(Library *library, QString filename); Library::Error LoadLibrary(Library *library, QString filename);
/** /**
* @brief Tries to load library file, prints message on error * @brief Tries to load library file, prints message on error
* @param library library to use * @param library library to use
* @param filename filename (no path) * @param filename filename (no path)
* @return True if no error * @return True if no error
*/ */
bool TryLoadLibrary(Library *library, QString filename); bool TryLoadLibrary(Library *library, QString filename);
/** /**
* @brief Update project MRU items in File-menu. * @brief Update project MRU items in File-menu.
*/ */
void UpdateMRUMenuItems(); void UpdateMRUMenuItems();
/** /**
* @brief Add project file (path) to the MRU list. * @brief Add project file (path) to the MRU list.
* @param project Full path to the project file to add. * @param project Full path to the project file to add.
*/ */
void AddProjectMRU(const QString &project); void AddProjectMRU(const QString &project);
/** /**
* @brief Remove project file (path) from the MRU list. * @brief Remove project file (path) from the MRU list.
* @param project Full path of the project file to remove. * @param project Full path of the project file to remove.
*/ */
void RemoveProjectMRU(const QString &project); void RemoveProjectMRU(const QString &project);
/** /** @brief Program settings */
* @brief Program settings
*
*/
QSettings *mSettings; QSettings *mSettings;
/** /** @brief Thread to check files */
* @brief Thread to check files
*
*/
ThreadHandler *mThread; ThreadHandler *mThread;
/** /** @brief List of user defined applications to open errors with */
* @brief List of user defined applications to open errors with
*
*/
ApplicationList *mApplications; ApplicationList *mApplications;
/** /** @brief Class to handle translation changes */
* @brief Class to handle translation changes
*
*/
TranslationHandler *mTranslation; TranslationHandler *mTranslation;
/** /** @brief Class holding all UI components */
* @brief Class holding all UI components
*
*/
Ui::MainWindow mUI; Ui::MainWindow mUI;
/** /** @brief Current checked directory. */
* @brief Current checked directory.
*/
QString mCurrentDirectory; QString mCurrentDirectory;
/** /** @brief Log view. */
* @brief Log view.
*/
LogView *mLogView; LogView *mLogView;
/** /** @brief Scratchpad. */
* @brief Scratchpad.
*/
ScratchPad* mScratchPad; ScratchPad* mScratchPad;
/** /** @brief Project (file). */
* @brief Project (file).
*/
Project *mProject; Project *mProject;
/** /** @brief Filter field in the Filter toolbar. */
* @brief Filter field in the Filter toolbar.
*/
QLineEdit* mLineEditFilter; QLineEdit* mLineEditFilter;
/** /** @brief Timer to delay filtering while typing. */
* @brief Timer to delay filtering while typing.
*/
QTimer* mFilterTimer; QTimer* mFilterTimer;
/** /** @brief GUI actions for selecting the checked platform. */
* @brief GUI actions for selecting the checked platform.
*/
QActionGroup *mPlatformActions; QActionGroup *mPlatformActions;
/** /** @brief GUI actions for selecting the coding standard. */
* @brief GUI actions for selecting the coding standard.
*/
QActionGroup *mCStandardActions, *mCppStandardActions; QActionGroup *mCStandardActions, *mCppStandardActions;
/** /** @brief GUI actions for selecting language. */
* @brief GUI actions for selecting language.
*/
QActionGroup *mSelectLanguageActions; QActionGroup *mSelectLanguageActions;
/** /**
* @brief Are we exiting the cppcheck? * @brief Are we exiting the cppcheck?
* If this is true then the cppcheck is waiting for check threads to exit * If this is true then the cppcheck is waiting for check threads to exit
* so that the application can be closed. * so that the application can be closed.
*/ */
bool mExiting; bool mExiting;
/** /** @brief Set to true in case of loading log file. */
* @brief Set to true in case of loading log file.
*/
bool mIsLogfileLoaded; bool mIsLogfileLoaded;
/** /**