Added more comments to class members and methods.
This commit is contained in:
parent
2b7bf671d7
commit
2d8b08d4ab
|
@ -25,6 +25,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
ApplicationDialog::ApplicationDialog(const QString &name,
|
ApplicationDialog::ApplicationDialog(const QString &name,
|
||||||
const QString &path,
|
const QString &path,
|
||||||
const QString &title)
|
const QString &title)
|
||||||
|
|
|
@ -23,21 +23,62 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dialog to edit a startable application.
|
||||||
|
* User can open errors with user specified applications. This is a dialog
|
||||||
|
* to modify/add an application to open errors with.
|
||||||
|
*
|
||||||
|
*/
|
||||||
class ApplicationDialog : public QDialog
|
class ApplicationDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*
|
||||||
|
* @param name Default name for the application to start
|
||||||
|
* @param path Path for the application
|
||||||
|
* @param title Title for the dialog
|
||||||
|
*/
|
||||||
ApplicationDialog(const QString &name,
|
ApplicationDialog(const QString &name,
|
||||||
const QString &path,
|
const QString &path,
|
||||||
const QString &title);
|
const QString &title);
|
||||||
virtual ~ApplicationDialog();
|
virtual ~ApplicationDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get modified name
|
||||||
|
* This is just a name to display the application. This has nothing to do
|
||||||
|
* with executing the application.
|
||||||
|
*
|
||||||
|
* @return Modified name
|
||||||
|
*/
|
||||||
QString GetName();
|
QString GetName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get modified path
|
||||||
|
* This also contains all parameters user wants to specify.
|
||||||
|
* @return Modified path
|
||||||
|
*/
|
||||||
QString GetPath();
|
QString GetPath();
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to browse for an application
|
||||||
|
*
|
||||||
|
*/
|
||||||
void Browse();
|
void Browse();
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief Editbox for the application's name
|
||||||
|
* This is just a name to display the application. This has nothing to do
|
||||||
|
* with executing the application.
|
||||||
|
*/
|
||||||
QLineEdit *mName;
|
QLineEdit *mName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Editbox for the application's path
|
||||||
|
* This also contains all parameters user wants to specify.
|
||||||
|
*/
|
||||||
QLineEdit *mPath;
|
QLineEdit *mPath;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,40 +24,126 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of applications user has specified to open errors with
|
||||||
|
* Each application has a name and a path. Name is displayed to the user
|
||||||
|
* and has no other meaning. It isn't used to start the application.
|
||||||
|
* Path contains the path to the application as well as the executable itself and
|
||||||
|
* any possible argument user might want to specify.
|
||||||
|
*
|
||||||
|
* User can also specify certain predefined strings to path. These strings
|
||||||
|
* will be replaced with appropriate values concerning the error. Strings are:
|
||||||
|
* (file) - Filename containing the error
|
||||||
|
* (line) - Line number containing the error
|
||||||
|
* (message) - Error message
|
||||||
|
* (severity) - Error severity
|
||||||
|
*
|
||||||
|
* Example opening a file with Kate and make Kate scroll to the corret line:
|
||||||
|
* kate -l(line) (file)
|
||||||
|
*
|
||||||
|
*/
|
||||||
class ApplicationList : public QObject
|
class ApplicationList : public QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Struct containing information of the application
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Applicaton's name
|
||||||
|
*
|
||||||
|
*/
|
||||||
QString Name;
|
QString Name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Application's path and commandline arguments
|
||||||
|
*
|
||||||
|
*/
|
||||||
QString Path;
|
QString Path;
|
||||||
}ApplicationType;
|
}ApplicationType;
|
||||||
|
|
||||||
ApplicationList();
|
ApplicationList();
|
||||||
virtual ~ApplicationList();
|
virtual ~ApplicationList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Load all applications
|
||||||
|
*
|
||||||
|
* @param programSettings QSettings to load application list from
|
||||||
|
*/
|
||||||
void LoadSettings(QSettings &programSettings);
|
void LoadSettings(QSettings &programSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Save all applications
|
||||||
|
* @param programSettings QSettings to save applications to
|
||||||
|
*/
|
||||||
void SaveSettings(QSettings &programSettings);
|
void SaveSettings(QSettings &programSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the amount of applications in the list
|
||||||
|
* @return The count of applications
|
||||||
|
*/
|
||||||
int GetApplicationCount();
|
int GetApplicationCount();
|
||||||
|
|
||||||
QString GetApplicationName(const int index);
|
/**
|
||||||
|
* @brief Get spesific application's name
|
||||||
|
*
|
||||||
|
* @param index Index of the application whose name to get
|
||||||
|
* @return Name of the application
|
||||||
|
*/
|
||||||
|
QString GetApplicationName(const int index);
|
||||||
|
|
||||||
QString GetApplicationPath(const int index);
|
/**
|
||||||
|
* @brief Get Application's path
|
||||||
|
*
|
||||||
|
* @param index of the application whose path to get
|
||||||
|
* @return Application's path
|
||||||
|
*/
|
||||||
|
QString GetApplicationPath(const int index);
|
||||||
|
|
||||||
void SetApplicationType(const int index,
|
/**
|
||||||
|
* @brief Modify an application
|
||||||
|
*
|
||||||
|
* @param index Index of the application to modify
|
||||||
|
* @param name New name for the application
|
||||||
|
* @param path New path for the application
|
||||||
|
*/
|
||||||
|
void SetApplicationType(const int index,
|
||||||
const QString &name,
|
const QString &name,
|
||||||
const QString &path);
|
const QString &path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a new application
|
||||||
|
*
|
||||||
|
* @param name Name of the application
|
||||||
|
* @param path Path to the application
|
||||||
|
*/
|
||||||
void AddApplicationType(const QString &name, const QString &path);
|
void AddApplicationType(const QString &name, const QString &path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove an application from the list
|
||||||
|
*
|
||||||
|
* @param index Index of the application to remove.
|
||||||
|
*/
|
||||||
void RemoveApplication(const int index);
|
void RemoveApplication(const int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Move certain application as first.
|
||||||
|
* Position of the application is used by the application to determine
|
||||||
|
* which of the applications is the default application. First application
|
||||||
|
* (index 0) is the default application.
|
||||||
|
*
|
||||||
|
* @param index Index of the application to make the default one
|
||||||
|
*/
|
||||||
void MoveFirst(const int index);
|
void MoveFirst(const int index);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of applications
|
||||||
|
*
|
||||||
|
*/
|
||||||
QList<ApplicationType> mApplications;
|
QList<ApplicationType> mApplications;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,7 +20,10 @@
|
||||||
#ifndef COMMON_H
|
#ifndef COMMON_H
|
||||||
#define COMMON_H
|
#define COMMON_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of error types to show
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SHOW_ALL = 0,
|
SHOW_ALL = 0,
|
||||||
|
|
120
gui/mainwindow.h
120
gui/mainwindow.h
|
@ -49,15 +49,57 @@ public slots:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void CheckFiles();
|
void CheckFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to recheck files
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ReCheck();
|
void ReCheck();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to clear all search results
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ClearResults();
|
void ClearResults();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Show errors with type "all"
|
||||||
|
* @param checked Should errors be shown (truw) or hidden (false)
|
||||||
|
*/
|
||||||
void ShowAll(bool checked);
|
void ShowAll(bool checked);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Show errors with type "security"
|
||||||
|
* @param checked Should errors be shown (truw) or hidden (false)
|
||||||
|
*/
|
||||||
void ShowSecurity(bool checked);
|
void ShowSecurity(bool checked);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Show errors with type "style"
|
||||||
|
* @param checked Should errors be shown (truw) or hidden (false)
|
||||||
|
*/
|
||||||
void ShowStyle(bool checked);
|
void ShowStyle(bool checked);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Show errors with type "unused"
|
||||||
|
* @param checked Should errors be shown (truw) or hidden (false)
|
||||||
|
*/
|
||||||
void ShowUnused(bool checked);
|
void ShowUnused(bool checked);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Show errors with type "error"
|
||||||
|
* @param checked Should errors be shown (truw) or hidden (false)
|
||||||
|
*/
|
||||||
void ShowErrors(bool checked);
|
void ShowErrors(bool checked);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to check all "Show errors" menu items
|
||||||
|
*/
|
||||||
void CheckAll();
|
void CheckAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to uncheck all "Show errors" menu items
|
||||||
|
*/
|
||||||
void UncheckAll();
|
void UncheckAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,6 +108,10 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void CheckDirectory();
|
void CheckDirectory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to open program's settings dialog
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ProgramSettings();
|
void ProgramSettings();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
@ -76,11 +122,47 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void CheckDone();
|
void CheckDone();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper function to toggle all show error menu items
|
||||||
|
* @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
|
||||||
|
*
|
||||||
|
*/
|
||||||
void EnableCheckButtons(bool enable);
|
void EnableCheckButtons(bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper function to open a dialog to ask user to select files to check
|
||||||
|
*
|
||||||
|
* @param mode Dialog open mode (files or directories)
|
||||||
|
*/
|
||||||
void DoCheckFiles(QFileDialog::FileMode mode);
|
void DoCheckFiles(QFileDialog::FileMode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get all files recursively from given path
|
||||||
|
*
|
||||||
|
* @param path Path to get files from
|
||||||
|
* @return List of file paths
|
||||||
|
*/
|
||||||
QStringList GetFilesRecursively(const QString &path);
|
QStringList GetFilesRecursively(const QString &path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get our default cppcheck settings
|
||||||
|
*
|
||||||
|
* @return Default cppcheck settings
|
||||||
|
*/
|
||||||
Settings GetCppCheckSettings();
|
Settings GetCppCheckSettings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Removes all unaccepted (by cppcheck core) files from the list
|
||||||
|
*
|
||||||
|
* @param list List to remove unaccepted files from
|
||||||
|
* @return List of files that are all accepted by cppcheck core
|
||||||
|
*/
|
||||||
QStringList RemoveUnacceptedFiles(const QStringList &list);
|
QStringList RemoveUnacceptedFiles(const QStringList &list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,12 +220,46 @@ protected:
|
||||||
*/
|
*/
|
||||||
QAction mActionSettings;
|
QAction mActionSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action to show errors with type "all"
|
||||||
|
*
|
||||||
|
*/
|
||||||
QAction mActionShowAll;
|
QAction mActionShowAll;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action to show errors with type "security"
|
||||||
|
*
|
||||||
|
*/
|
||||||
QAction mActionShowSecurity;
|
QAction mActionShowSecurity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action to show errors with type "style"
|
||||||
|
*
|
||||||
|
*/
|
||||||
QAction mActionShowStyle;
|
QAction mActionShowStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action to show errors with type "unused"
|
||||||
|
*
|
||||||
|
*/
|
||||||
QAction mActionShowUnused;
|
QAction mActionShowUnused;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action to show errors with type "error"
|
||||||
|
*
|
||||||
|
*/
|
||||||
QAction mActionShowErrors;
|
QAction mActionShowErrors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action to check all "show error" menu items
|
||||||
|
*
|
||||||
|
*/
|
||||||
QAction mActionShowCheckAll;
|
QAction mActionShowCheckAll;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action to uncheck all "show error" menu items
|
||||||
|
*
|
||||||
|
*/
|
||||||
QAction mActionShowUncheckAll;
|
QAction mActionShowUncheckAll;
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,6 +276,10 @@ protected:
|
||||||
*/
|
*/
|
||||||
ThreadHandler mThread;
|
ThreadHandler mThread;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of user defined applications to open errors with
|
||||||
|
*
|
||||||
|
*/
|
||||||
ApplicationList mApplications;
|
ApplicationList mApplications;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -204,7 +204,6 @@ void ResultsTree::ShowResults(ShowTypes type, bool show)
|
||||||
{
|
{
|
||||||
mShowTypes[type] = show;
|
mShowTypes[type] = show;
|
||||||
RefreshTree();
|
RefreshTree();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,26 +260,6 @@ void ResultsTree::RefreshTree()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResultsTree::ShowTypeToString(ShowTypes type)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case SHOW_ALL:
|
|
||||||
return "all";
|
|
||||||
case SHOW_ERRORS:
|
|
||||||
return "error";
|
|
||||||
case SHOW_STYLE:
|
|
||||||
return "style";
|
|
||||||
case SHOW_SECURITY:
|
|
||||||
return "security";
|
|
||||||
case SHOW_UNUSED:
|
|
||||||
return "unused";
|
|
||||||
case SHOW_NONE:
|
|
||||||
return "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
QStandardItem *ResultsTree::EnsureFileItem(const QString &name)
|
QStandardItem *ResultsTree::EnsureFileItem(const QString &name)
|
||||||
{
|
{
|
||||||
|
@ -350,7 +329,6 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
||||||
//Start the menu
|
//Start the menu
|
||||||
menu.exec(e->globalPos());
|
menu.exec(e->globalPos());
|
||||||
|
|
||||||
|
|
||||||
//Disconnect all signals
|
//Disconnect all signals
|
||||||
for (int i = 0;i < actions.size();i++)
|
for (int i = 0;i < actions.size();i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,9 @@ public:
|
||||||
*
|
*
|
||||||
* @param file filename
|
* @param file filename
|
||||||
* @param severity error severity
|
* @param severity error severity
|
||||||
* @param error error message
|
* @param message error message
|
||||||
|
* @param files list of files affected by the error
|
||||||
|
* @param lines list of file line numers affected by the error
|
||||||
*/
|
*/
|
||||||
void AddErrorItem(const QString &file,
|
void AddErrorItem(const QString &file,
|
||||||
const QString &severity,
|
const QString &severity,
|
||||||
|
@ -60,9 +62,22 @@ public:
|
||||||
*/
|
*/
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to show/hide certain type of errors
|
||||||
|
* Refreshes the tree.
|
||||||
|
*
|
||||||
|
* @param type Type of error to show/hide
|
||||||
|
* @param Should specified errors be shown (true) or hidden (false)
|
||||||
|
*/
|
||||||
void ShowResults(ShowTypes type, bool show);
|
void ShowResults(ShowTypes type, bool show);
|
||||||
protected slots:
|
protected slots:
|
||||||
|
/**
|
||||||
|
* @brief Slot to quickstart an error with default application
|
||||||
|
*
|
||||||
|
* @param index Model index to specify which error item to open
|
||||||
|
*/
|
||||||
void QuickStartApplication(const QModelIndex &index);
|
void QuickStartApplication(const QModelIndex &index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Slot for context menu item to open an error with specified application
|
* @brief Slot for context menu item to open an error with specified application
|
||||||
*
|
*
|
||||||
|
@ -70,9 +85,34 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void Context(int application);
|
void Context(int application);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper function to open an error within target with application
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param target Error tree item to open
|
||||||
|
* @param application Index of the application to open with
|
||||||
|
*/
|
||||||
void StartApplication(QStandardItem *target, int application);
|
void StartApplication(QStandardItem *target, int application);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Context menu event (user right clicked on the tree)
|
||||||
|
*
|
||||||
|
* @param e Event
|
||||||
|
*/
|
||||||
void contextMenuEvent(QContextMenuEvent * e);
|
void contextMenuEvent(QContextMenuEvent * e);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a new error item beneath a file or a backtrace item beneath an error
|
||||||
|
*
|
||||||
|
* @param parent Parent for the item. Either a file item or an error item
|
||||||
|
* @param file Filename of the error
|
||||||
|
* @param line Line numer
|
||||||
|
* @param severity Error severity
|
||||||
|
* @param message Error message
|
||||||
|
* @param hide Should this be hidden (true) or shown (false)
|
||||||
|
* @return newly created QStandardItem *
|
||||||
|
*/
|
||||||
QStandardItem *AddBacktraceFiles(QStandardItem *parent,
|
QStandardItem *AddBacktraceFiles(QStandardItem *parent,
|
||||||
const QString &file,
|
const QString &file,
|
||||||
const int line,
|
const int line,
|
||||||
|
@ -80,11 +120,28 @@ protected:
|
||||||
const QString &message,
|
const QString &message,
|
||||||
const bool hide);
|
const bool hide);
|
||||||
|
|
||||||
void AddItem(int index);
|
|
||||||
|
/**
|
||||||
|
* @brief Refresh tree by checking which of the items should be shown
|
||||||
|
* and which should be hidden
|
||||||
|
*
|
||||||
|
*/
|
||||||
void RefreshTree();
|
void RefreshTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Convert QVariant (that contains an int) to Showtypes value
|
||||||
|
*
|
||||||
|
* @param data QVariant (that contains an int) to be converted
|
||||||
|
* @return data converted to ShowTypes
|
||||||
|
*/
|
||||||
ShowTypes VariantToShowType(const QVariant &data);
|
ShowTypes VariantToShowType(const QVariant &data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Convert severity string to ShowTypes value
|
||||||
|
* @param severity Error severity string
|
||||||
|
* @return Severity converted to ShowTypes value
|
||||||
|
*/
|
||||||
ShowTypes SeverityToShowType(const QString &severity);
|
ShowTypes SeverityToShowType(const QString &severity);
|
||||||
QString ShowTypeToString(ShowTypes type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load all settings
|
* @brief Load all settings
|
||||||
|
@ -142,8 +199,17 @@ protected:
|
||||||
*/
|
*/
|
||||||
QSettings &mSettings;
|
QSettings &mSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of bools to determine which of ShowTypes to display on the tree
|
||||||
|
* (true) and which of them should be hidden (false)
|
||||||
|
*
|
||||||
|
*/
|
||||||
bool mShowTypes[SHOW_NONE];
|
bool mShowTypes[SHOW_NONE];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of applications to open errors with
|
||||||
|
*
|
||||||
|
*/
|
||||||
ApplicationList &mApplications;
|
ApplicationList &mApplications;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,6 +41,13 @@ public:
|
||||||
ResultsView(QSettings &settings, ApplicationList &list);
|
ResultsView(QSettings &settings, ApplicationList &list);
|
||||||
virtual ~ResultsView();
|
virtual ~ResultsView();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to show/hide certain type of errors
|
||||||
|
* Refreshes the tree.
|
||||||
|
*
|
||||||
|
* @param type Type of error to show/hide
|
||||||
|
* @param Should specified errors be shown (true) or hidden (false)
|
||||||
|
*/
|
||||||
void ShowResults(ShowTypes type, bool show);
|
void ShowResults(ShowTypes type, bool show);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,10 +56,24 @@ public:
|
||||||
*/
|
*/
|
||||||
void Clear();
|
void Clear();
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
|
||||||
* Slots for CheckThread's signals
|
/**
|
||||||
|
* @brief Slot for updating the checking progress
|
||||||
|
*
|
||||||
|
* @param value Current progress value
|
||||||
|
* @param max Maximum progress value
|
||||||
*/
|
*/
|
||||||
void Progress(int value, int max);
|
void Progress(int value, int max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot for new error to be displayed
|
||||||
|
*
|
||||||
|
* @param file filename
|
||||||
|
* @param severity error severity
|
||||||
|
* @param message error message
|
||||||
|
* @param files list of files affected by the error
|
||||||
|
* @param lines list of file line numers affected by the error
|
||||||
|
*/
|
||||||
void Error(const QString &file,
|
void Error(const QString &file,
|
||||||
const QString &severity,
|
const QString &severity,
|
||||||
const QString &message,
|
const QString &message,
|
||||||
|
|
|
@ -44,12 +44,37 @@ class SettingsDialog : public QDialog
|
||||||
public:
|
public:
|
||||||
SettingsDialog(QSettings &programSettings, ApplicationList &list);
|
SettingsDialog(QSettings &programSettings, ApplicationList &list);
|
||||||
virtual ~SettingsDialog();
|
virtual ~SettingsDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Save all values to QSettings
|
||||||
|
*
|
||||||
|
*/
|
||||||
void SaveCheckboxValues();
|
void SaveCheckboxValues();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot for adding a new application to the list
|
||||||
|
*
|
||||||
|
*/
|
||||||
void AddApplication();
|
void AddApplication();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot for deleting an application from the list
|
||||||
|
*
|
||||||
|
*/
|
||||||
void DeleteApplication();
|
void DeleteApplication();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot for modifying an application in the list
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ModifyApplication();
|
void ModifyApplication();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot for making the selected application as the default (first)
|
||||||
|
*
|
||||||
|
*/
|
||||||
void DefaultApplication();
|
void DefaultApplication();
|
||||||
protected:
|
protected:
|
||||||
void PopulateListWidget();
|
void PopulateListWidget();
|
||||||
|
@ -129,6 +154,11 @@ protected:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
QSettings &mSettings;
|
QSettings &mSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of applications user has specified
|
||||||
|
*
|
||||||
|
*/
|
||||||
ApplicationList &mApplications;
|
ApplicationList &mApplications;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,9 +39,30 @@ class ThreadHandler : public QObject
|
||||||
public:
|
public:
|
||||||
ThreadHandler();
|
ThreadHandler();
|
||||||
virtual ~ThreadHandler();
|
virtual ~ThreadHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the number of threads to use
|
||||||
|
* @param count The number of threads to use
|
||||||
|
*/
|
||||||
void SetThreadCount(const int count);
|
void SetThreadCount(const int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize the threads (connect all signals to resultsview's slots)
|
||||||
|
*
|
||||||
|
* @param view View to show error results
|
||||||
|
*/
|
||||||
void Initialize(ResultsView *view);
|
void Initialize(ResultsView *view);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Load settings
|
||||||
|
* @param settings QSettings to load settings from
|
||||||
|
*/
|
||||||
void LoadSettings(QSettings &settings);
|
void LoadSettings(QSettings &settings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Save settings
|
||||||
|
* @param settings QSettings to save settings to
|
||||||
|
*/
|
||||||
void SaveSettings(QSettings &settings);
|
void SaveSettings(QSettings &settings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,19 +78,63 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetFiles(const QStringList &files);
|
void SetFiles(const QStringList &files);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Start the threads to check the files
|
||||||
|
*
|
||||||
|
* @param settings Settings for checking
|
||||||
|
* @param recheck Should we reuse the files we checked earleir
|
||||||
|
*/
|
||||||
void Check(Settings settings, bool recheck);
|
void Check(Settings settings, bool recheck);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief Signal that all threads are done
|
||||||
|
*
|
||||||
|
*/
|
||||||
void Done();
|
void Done();
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to stop all threads
|
||||||
|
*
|
||||||
|
*/
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot that a single thread is done
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ThreadDone();
|
void ThreadDone();
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief List of files checked last time (used when rechecking)
|
||||||
|
*
|
||||||
|
*/
|
||||||
QStringList mLastFiles;
|
QStringList mLastFiles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to delete all threads
|
||||||
|
*
|
||||||
|
*/
|
||||||
void RemoveThreads();
|
void RemoveThreads();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Thread results are stored here
|
||||||
|
*
|
||||||
|
*/
|
||||||
ThreadResult mResults;
|
ThreadResult mResults;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of threads currently in use
|
||||||
|
*
|
||||||
|
*/
|
||||||
QList<CheckThread *> mThreads;
|
QList<CheckThread *> mThreads;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The amount of threads currently running
|
||||||
|
*
|
||||||
|
*/
|
||||||
int mRunningThreadCount;
|
int mRunningThreadCount;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,9 +37,29 @@ class ThreadResult : public QObject, public ErrorLogger
|
||||||
public:
|
public:
|
||||||
ThreadResult();
|
ThreadResult();
|
||||||
virtual ~ThreadResult();
|
virtual ~ThreadResult();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get next unprocessed file
|
||||||
|
* @return File path
|
||||||
|
*/
|
||||||
QString GetNextFile();
|
QString GetNextFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set list of files to check
|
||||||
|
* @param files List of files to check
|
||||||
|
*/
|
||||||
void SetFiles(const QStringList &files);
|
void SetFiles(const QStringList &files);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear files to check
|
||||||
|
*
|
||||||
|
*/
|
||||||
void ClearFiles();
|
void ClearFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the number of files to check
|
||||||
|
*
|
||||||
|
*/
|
||||||
int GetFileCount();
|
int GetFileCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,9 +69,29 @@ public:
|
||||||
void reportErr(const ErrorLogger::ErrorMessage &msg);
|
void reportErr(const ErrorLogger::ErrorMessage &msg);
|
||||||
void reportStatus(unsigned int index, unsigned int max);
|
void reportStatus(unsigned int index, unsigned int max);
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot threads use to signal this class that a spesific file is checked
|
||||||
|
* @param file File taht is checked
|
||||||
|
*/
|
||||||
void FileChecked(const QString &file);
|
void FileChecked(const QString &file);
|
||||||
signals:
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief Progress signal
|
||||||
|
* @param value Current progress
|
||||||
|
* @param max Maximum progress
|
||||||
|
*/
|
||||||
void Progress(int value, int max);
|
void Progress(int value, int max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Signal of a new error
|
||||||
|
*
|
||||||
|
* @param file filename
|
||||||
|
* @param severity error severity
|
||||||
|
* @param message error message
|
||||||
|
* @param files list of files affected by the error
|
||||||
|
* @param lines list of file line numers affected by the error
|
||||||
|
*/
|
||||||
void Error(const QString &file,
|
void Error(const QString &file,
|
||||||
const QString &severity,
|
const QString &severity,
|
||||||
const QString &message,
|
const QString &message,
|
||||||
|
@ -59,9 +99,29 @@ signals:
|
||||||
const QVariantList &lines);
|
const QVariantList &lines);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mutex
|
||||||
|
*
|
||||||
|
*/
|
||||||
mutable QMutex mutex;
|
mutable QMutex mutex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief List of files to check
|
||||||
|
*
|
||||||
|
*/
|
||||||
QStringList mFiles;
|
QStringList mFiles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Max progress
|
||||||
|
*
|
||||||
|
*/
|
||||||
int mMaxProgress;
|
int mMaxProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Current progress
|
||||||
|
*
|
||||||
|
*/
|
||||||
int mProgress;
|
int mProgress;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue