Skip to content

Commit 2d8b08d

Browse files
committed
Added more comments to class members and methods.
1 parent 2b7bf67 commit 2d8b08d

File tree

11 files changed

+506
-35
lines changed

11 files changed

+506
-35
lines changed

gui/applicationdialog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <QFileDialog>
2626
#include <QDebug>
2727

28+
2829
ApplicationDialog::ApplicationDialog(const QString &name,
2930
const QString &path,
3031
const QString &title)

gui/applicationdialog.h

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,62 @@
2323
#include <QDialog>
2424
#include <QLineEdit>
2525

26-
26+
/**
27+
* @brief Dialog to edit a startable application.
28+
* User can open errors with user specified applications. This is a dialog
29+
* to modify/add an application to open errors with.
30+
*
31+
*/
2732
class ApplicationDialog : public QDialog
2833
{
2934
Q_OBJECT
3035
public:
36+
/**
37+
* @brief Constructor
38+
*
39+
* @param name Default name for the application to start
40+
* @param path Path for the application
41+
* @param title Title for the dialog
42+
*/
3143
ApplicationDialog(const QString &name,
3244
const QString &path,
3345
const QString &title);
3446
virtual ~ApplicationDialog();
47+
48+
/**
49+
* @brief Get modified name
50+
* This is just a name to display the application. This has nothing to do
51+
* with executing the application.
52+
*
53+
* @return Modified name
54+
*/
3555
QString GetName();
56+
57+
/**
58+
* @brief Get modified path
59+
* This also contains all parameters user wants to specify.
60+
* @return Modified path
61+
*/
3662
QString GetPath();
3763
protected slots:
64+
65+
/**
66+
* @brief Slot to browse for an application
67+
*
68+
*/
3869
void Browse();
3970
protected:
71+
/**
72+
* @brief Editbox for the application's name
73+
* This is just a name to display the application. This has nothing to do
74+
* with executing the application.
75+
*/
4076
QLineEdit *mName;
77+
78+
/**
79+
* @brief Editbox for the application's path
80+
* This also contains all parameters user wants to specify.
81+
*/
4182
QLineEdit *mPath;
4283
private:
4384
};

gui/applicationlist.h

Lines changed: 92 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,126 @@
2424
#include <QSettings>
2525

2626

27+
/**
28+
* @brief List of applications user has specified to open errors with
29+
* Each application has a name and a path. Name is displayed to the user
30+
* and has no other meaning. It isn't used to start the application.
31+
* Path contains the path to the application as well as the executable itself and
32+
* any possible argument user might want to specify.
33+
*
34+
* User can also specify certain predefined strings to path. These strings
35+
* will be replaced with appropriate values concerning the error. Strings are:
36+
* (file) - Filename containing the error
37+
* (line) - Line number containing the error
38+
* (message) - Error message
39+
* (severity) - Error severity
40+
*
41+
* Example opening a file with Kate and make Kate scroll to the corret line:
42+
* kate -l(line) (file)
43+
*
44+
*/
2745
class ApplicationList : public QObject
2846
{
2947
public:
48+
49+
/**
50+
* @brief Struct containing information of the application
51+
*
52+
*/
3053
typedef struct
3154
{
55+
/**
56+
* @brief Applicaton's name
57+
*
58+
*/
3259
QString Name;
60+
61+
/**
62+
* @brief Application's path and commandline arguments
63+
*
64+
*/
3365
QString Path;
3466
}ApplicationType;
3567

3668
ApplicationList();
3769
virtual ~ApplicationList();
3870

71+
/**
72+
* @brief Load all applications
73+
*
74+
* @param programSettings QSettings to load application list from
75+
*/
3976
void LoadSettings(QSettings &programSettings);
4077

78+
/**
79+
* @brief Save all applications
80+
* @param programSettings QSettings to save applications to
81+
*/
4182
void SaveSettings(QSettings &programSettings);
4283

84+
/**
85+
* @brief Get the amount of applications in the list
86+
* @return The count of applications
87+
*/
4388
int GetApplicationCount();
4489

45-
QString GetApplicationName(const int index);
46-
47-
QString GetApplicationPath(const int index);
48-
49-
void SetApplicationType(const int index,
90+
/**
91+
* @brief Get spesific application's name
92+
*
93+
* @param index Index of the application whose name to get
94+
* @return Name of the application
95+
*/
96+
QString GetApplicationName(const int index);
97+
98+
/**
99+
* @brief Get Application's path
100+
*
101+
* @param index of the application whose path to get
102+
* @return Application's path
103+
*/
104+
QString GetApplicationPath(const int index);
105+
106+
/**
107+
* @brief Modify an application
108+
*
109+
* @param index Index of the application to modify
110+
* @param name New name for the application
111+
* @param path New path for the application
112+
*/
113+
void SetApplicationType(const int index,
50114
const QString &name,
51115
const QString &path);
52116

117+
/**
118+
* @brief Add a new application
119+
*
120+
* @param name Name of the application
121+
* @param path Path to the application
122+
*/
53123
void AddApplicationType(const QString &name, const QString &path);
54124

125+
/**
126+
* @brief Remove an application from the list
127+
*
128+
* @param index Index of the application to remove.
129+
*/
55130
void RemoveApplication(const int index);
56131

132+
/**
133+
* @brief Move certain application as first.
134+
* Position of the application is used by the application to determine
135+
* which of the applications is the default application. First application
136+
* (index 0) is the default application.
137+
*
138+
* @param index Index of the application to make the default one
139+
*/
57140
void MoveFirst(const int index);
58141
protected:
59142

60-
143+
/**
144+
* @brief List of applications
145+
*
146+
*/
61147
QList<ApplicationType> mApplications;
62148
private:
63149
};

gui/common.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
#ifndef COMMON_H
2121
#define COMMON_H
2222

23-
23+
/**
24+
* @brief List of error types to show
25+
*
26+
*/
2427
typedef enum
2528
{
2629
SHOW_ALL = 0,

gui/mainwindow.h

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,57 @@ public slots:
4949
*
5050
*/
5151
void CheckFiles();
52+
53+
/**
54+
* @brief Slot to recheck files
55+
*
56+
*/
5257
void ReCheck();
58+
59+
/**
60+
* @brief Slot to clear all search results
61+
*
62+
*/
5363
void ClearResults();
5464

65+
/**
66+
* @brief Show errors with type "all"
67+
* @param checked Should errors be shown (truw) or hidden (false)
68+
*/
5569
void ShowAll(bool checked);
70+
71+
/**
72+
* @brief Show errors with type "security"
73+
* @param checked Should errors be shown (truw) or hidden (false)
74+
*/
5675
void ShowSecurity(bool checked);
76+
77+
/**
78+
* @brief Show errors with type "style"
79+
* @param checked Should errors be shown (truw) or hidden (false)
80+
*/
5781
void ShowStyle(bool checked);
82+
83+
/**
84+
* @brief Show errors with type "unused"
85+
* @param checked Should errors be shown (truw) or hidden (false)
86+
*/
5887
void ShowUnused(bool checked);
88+
89+
/**
90+
* @brief Show errors with type "error"
91+
* @param checked Should errors be shown (truw) or hidden (false)
92+
*/
5993
void ShowErrors(bool checked);
94+
95+
/**
96+
* @brief Slot to check all "Show errors" menu items
97+
*/
6098
void CheckAll();
99+
100+
/**
101+
* @brief Slot to uncheck all "Show errors" menu items
102+
*/
61103
void UncheckAll();
62104

63105
/**
@@ -66,6 +108,10 @@ public slots:
66108
*/
67109
void CheckDirectory();
68110

111+
/**
112+
* @brief Slot to open program's settings dialog
113+
*
114+
*/
69115
void ProgramSettings();
70116

71117
protected slots:
@@ -76,11 +122,47 @@ protected slots:
76122
*/
77123
void CheckDone();
78124
protected:
125+
126+
/**
127+
* @brief Helper function to toggle all show error menu items
128+
* @param checked Should all errors be shown (true) or hidden (false)
129+
*/
79130
void ToggleAllChecked(bool checked);
131+
132+
/**
133+
* @brief Helper function to enable/disable all check,recheck buttons
134+
*
135+
*/
80136
void EnableCheckButtons(bool enable);
137+
138+
/**
139+
* @brief Helper function to open a dialog to ask user to select files to check
140+
*
141+
* @param mode Dialog open mode (files or directories)
142+
*/
81143
void DoCheckFiles(QFileDialog::FileMode mode);
144+
145+
/**
146+
* @brief Get all files recursively from given path
147+
*
148+
* @param path Path to get files from
149+
* @return List of file paths
150+
*/
82151
QStringList GetFilesRecursively(const QString &path);
152+
153+
/**
154+
* @brief Get our default cppcheck settings
155+
*
156+
* @return Default cppcheck settings
157+
*/
83158
Settings GetCppCheckSettings();
159+
160+
/**
161+
* @brief Removes all unaccepted (by cppcheck core) files from the list
162+
*
163+
* @param list List to remove unaccepted files from
164+
* @return List of files that are all accepted by cppcheck core
165+
*/
84166
QStringList RemoveUnacceptedFiles(const QStringList &list);
85167

86168
/**
@@ -138,12 +220,46 @@ protected slots:
138220
*/
139221
QAction mActionSettings;
140222

223+
/**
224+
* @brief Action to show errors with type "all"
225+
*
226+
*/
141227
QAction mActionShowAll;
228+
229+
/**
230+
* @brief Action to show errors with type "security"
231+
*
232+
*/
142233
QAction mActionShowSecurity;
234+
235+
/**
236+
* @brief Action to show errors with type "style"
237+
*
238+
*/
143239
QAction mActionShowStyle;
240+
241+
/**
242+
* @brief Action to show errors with type "unused"
243+
*
244+
*/
144245
QAction mActionShowUnused;
246+
247+
/**
248+
* @brief Action to show errors with type "error"
249+
*
250+
*/
145251
QAction mActionShowErrors;
252+
253+
/**
254+
* @brief Action to check all "show error" menu items
255+
*
256+
*/
146257
QAction mActionShowCheckAll;
258+
259+
/**
260+
* @brief Action to uncheck all "show error" menu items
261+
*
262+
*/
147263
QAction mActionShowUncheckAll;
148264

149265

@@ -160,6 +276,10 @@ protected slots:
160276
*/
161277
ThreadHandler mThread;
162278

279+
/**
280+
* @brief List of user defined applications to open errors with
281+
*
282+
*/
163283
ApplicationList mApplications;
164284

165285
private:

0 commit comments

Comments
 (0)