GUI: Rename ResultsTree methods

This commit is contained in:
Daniel Marjamäki 2017-07-28 11:54:20 +02:00
parent 1f0720db3f
commit 090062baaf
3 changed files with 168 additions and 168 deletions

View File

@ -56,7 +56,7 @@ ResultsTree::ResultsTree(QWidget * parent) :
mSelectionModel(0)
{
setModel(&mModel);
Translate(); // Adds columns to grid
translate(); // Adds columns to grid
setExpandsOnDoubleClick(false);
setSortingEnabled(true);
@ -71,21 +71,21 @@ ResultsTree::~ResultsTree()
void ResultsTree::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
QuickStartApplication(this->currentIndex());
quickStartApplication(this->currentIndex());
}
QTreeView::keyPressEvent(event);
}
void ResultsTree::Initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
void ResultsTree::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
{
mSettings = settings;
mApplications = list;
mThread = checkThreadHandler;
LoadSettings();
loadSettings();
}
QStandardItem *ResultsTree::CreateNormalItem(const QString &name)
QStandardItem *ResultsTree::createNormalItem(const QString &name)
{
QStandardItem *item = new QStandardItem(name);
item->setData(name, Qt::ToolTipRole);
@ -93,7 +93,7 @@ QStandardItem *ResultsTree::CreateNormalItem(const QString &name)
return item;
}
QStandardItem *ResultsTree::CreateCheckboxItem(bool checked)
QStandardItem *ResultsTree::createCheckboxItem(bool checked)
{
QStandardItem *item = new QStandardItem;
item->setCheckable(true);
@ -102,7 +102,7 @@ QStandardItem *ResultsTree::CreateCheckboxItem(bool checked)
return item;
}
QStandardItem *ResultsTree::CreateLineNumberItem(const QString &linenumber)
QStandardItem *ResultsTree::createLineNumberItem(const QString &linenumber)
{
QStandardItem *item = new QStandardItem();
item->setData(QVariant(linenumber.toULongLong()), Qt::DisplayRole);
@ -112,13 +112,13 @@ QStandardItem *ResultsTree::CreateLineNumberItem(const QString &linenumber)
return item;
}
bool ResultsTree::AddErrorItem(const ErrorItem &item)
bool ResultsTree::addErrorItem(const ErrorItem &item)
{
if (item.errorPath.isEmpty()) {
return false;
}
QString realfile = StripPath(item.errorPath.back().file, false);
QString realfile = stripPath(item.errorPath.back().file, false);
if (realfile.isEmpty()) {
realfile = tr("Undefined file");
@ -151,11 +151,11 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
line.severity = item.severity;
//Create the base item for the error and ensure it has a proper
//file item as a parent
QStandardItem* fileItem = EnsureFileItem(item.errorPath.back().file, item.file0, hide);
QStandardItem* stditem = AddBacktraceFiles(fileItem,
QStandardItem* fileItem = ensureFileItem(item.errorPath.back().file, item.file0, hide);
QStandardItem* stditem = addBacktraceFiles(fileItem,
line,
hide,
SeverityToIcon(line.severity),
severityToIcon(line.severity),
false);
if (!stditem)
@ -171,7 +171,7 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
data["line"] = item.errorPath.back().line;
data["id"] = item.errorId;
data["inconclusive"] = item.inconclusive;
data["file0"] = StripPath(item.file0, true);
data["file0"] = stripPath(item.file0, true);
stditem->setData(QVariant(data));
//Add backtrace files as children
@ -182,7 +182,7 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
line.line = e.line;
line.message = line.summary = e.info;
QStandardItem *child_item;
child_item = AddBacktraceFiles(stditem,
child_item = addBacktraceFiles(stditem,
line,
hide,
":images/go-down.png",
@ -210,7 +210,7 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item)
return true;
}
QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
QStandardItem *ResultsTree::addBacktraceFiles(QStandardItem *parent,
const ErrorLine &item,
const bool hide,
const QString &icon,
@ -222,12 +222,12 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
QList<QStandardItem*> list;
// Ensure shown path is with native separators
list << CreateNormalItem(QDir::toNativeSeparators(item.file))
<< CreateNormalItem(childOfMessage ? tr("note") : SeverityToTranslatedString(item.severity))
<< CreateLineNumberItem(QString::number(item.line))
<< CreateNormalItem(childOfMessage ? QString() : item.errorId)
<< (childOfMessage ? CreateNormalItem(QString()) : CreateCheckboxItem(item.inconclusive))
<< CreateNormalItem(item.summary);
list << createNormalItem(QDir::toNativeSeparators(item.file))
<< createNormalItem(childOfMessage ? tr("note") : severityToTranslatedString(item.severity))
<< createLineNumberItem(QString::number(item.line))
<< createNormalItem(childOfMessage ? QString() : item.errorId)
<< (childOfMessage ? createNormalItem(QString()) : createCheckboxItem(item.inconclusive))
<< createNormalItem(item.summary);
//TODO message has parameter names so we'll need changes to the core
//cppcheck so we can get proper translations
@ -261,7 +261,7 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
return list[0];
}
QString ResultsTree::SeverityToTranslatedString(Severity::SeverityType severity)
QString ResultsTree::severityToTranslatedString(Severity::SeverityType severity)
{
switch (severity) {
case Severity::style:
@ -291,7 +291,7 @@ QString ResultsTree::SeverityToTranslatedString(Severity::SeverityType severity)
}
}
QStandardItem *ResultsTree::FindFileItem(const QString &name) const
QStandardItem *ResultsTree::findFileItem(const QString &name) const
{
// The first column contains the file name. In Windows we can get filenames
// "header.h" and "Header.h" and must compare them as identical.
@ -307,14 +307,14 @@ QStandardItem *ResultsTree::FindFileItem(const QString &name) const
return 0;
}
void ResultsTree::Clear()
void ResultsTree::clear()
{
mModel.removeRows(0, mModel.rowCount());
}
void ResultsTree::Clear(const QString &filename)
void ResultsTree::clear(const QString &filename)
{
const QString stripped = StripPath(filename, false);
const QString stripped = stripPath(filename, false);
for (int i = 0; i < mModel.rowCount(); ++i) {
const QStandardItem *item = mModel.item(i, 0);
@ -330,7 +330,7 @@ void ResultsTree::Clear(const QString &filename)
}
}
void ResultsTree::ClearRecheckFile(const QString &filename)
void ResultsTree::clearRecheckFile(const QString &filename)
{
for (int i = 0; i < mModel.rowCount(); ++i) {
const QStandardItem *item = mModel.item(i, 0);
@ -349,7 +349,7 @@ void ResultsTree::ClearRecheckFile(const QString &filename)
}
void ResultsTree::LoadSettings()
void ResultsTree::loadSettings()
{
for (int i = 0; i < mModel.columnCount(); i++) {
QString temp = QString(SETTINGS_RESULT_COLUMN_WIDTH).arg(i);
@ -360,11 +360,11 @@ void ResultsTree::LoadSettings()
mSaveAllErrors = mSettings->value(SETTINGS_SAVE_ALL_ERRORS, false).toBool();
mShowFullPath = mSettings->value(SETTINGS_SHOW_FULL_PATH, false).toBool();
ShowIdColumn(mSettings->value(SETTINGS_SHOW_ERROR_ID, false).toBool());
ShowInconclusiveColumn(mSettings->value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool());
showIdColumn(mSettings->value(SETTINGS_SHOW_ERROR_ID, false).toBool());
showInconclusiveColumn(mSettings->value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool());
}
void ResultsTree::SaveSettings() const
void ResultsTree::saveSettings() const
{
for (int i = 0; i < mModel.columnCount(); i++) {
QString temp = QString(SETTINGS_RESULT_COLUMN_WIDTH).arg(i);
@ -372,21 +372,21 @@ void ResultsTree::SaveSettings() const
}
}
void ResultsTree::ShowResults(ShowTypes::ShowType type, bool show)
void ResultsTree::showResults(ShowTypes::ShowType type, bool show)
{
if (type != ShowTypes::ShowNone && mShowSeverities.isShown(type) != show) {
mShowSeverities.show(type, show);
RefreshTree();
refreshTree();
}
}
void ResultsTree::FilterResults(const QString& filter)
void ResultsTree::filterResults(const QString& filter)
{
mFilter = filter;
RefreshTree();
refreshTree();
}
void ResultsTree::ShowHiddenResults()
void ResultsTree::showHiddenResults()
{
//Clear the "hide" flag for each item
int filecount = mModel.rowCount();
@ -409,12 +409,12 @@ void ResultsTree::ShowHiddenResults()
}
}
}
RefreshTree();
emit ResultsHidden(false);
refreshTree();
emit resultsHidden(false);
}
void ResultsTree::RefreshTree()
void ResultsTree::refreshTree()
{
mVisibleErrors = false;
//Get the amount of files in the tree
@ -481,12 +481,12 @@ void ResultsTree::RefreshTree()
}
}
QStandardItem *ResultsTree::EnsureFileItem(const QString &fullpath, const QString &file0, bool hide)
QStandardItem *ResultsTree::ensureFileItem(const QString &fullpath, const QString &file0, bool hide)
{
QString name = StripPath(fullpath, false);
QString name = stripPath(fullpath, false);
// Since item has path with native separators we must use path with
// native separators to find it.
QStandardItem *item = FindFileItem(QDir::toNativeSeparators(name));
QStandardItem *item = findFileItem(QDir::toNativeSeparators(name));
if (item) {
return item;
@ -494,7 +494,7 @@ QStandardItem *ResultsTree::EnsureFileItem(const QString &fullpath, const QStrin
// Ensure shown path is with native separators
name = QDir::toNativeSeparators(name);
item = CreateNormalItem(name);
item = createNormalItem(name);
item->setIcon(QIcon(":images/text-x-generic.png"));
//Add user data to that item
@ -625,7 +625,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
}
}
void ResultsTree::StartApplication(QStandardItem *target, int application)
void ResultsTree::startApplication(QStandardItem *target, int application)
{
//If there are no applications specified, tell the user about it
if (mApplications->getApplicationCount() == 0) {
@ -682,7 +682,7 @@ void ResultsTree::StartApplication(QStandardItem *target, int application)
if (checkdir.isAbsolute() && checkdir.exists()) {
file = mCheckPath + "/" + file;
} else {
QString dir = AskFileDir(file);
QString dir = askFileDir(file);
dir += '/';
file = dir + file;
}
@ -732,7 +732,7 @@ void ResultsTree::StartApplication(QStandardItem *target, int application)
}
}
QString ResultsTree::AskFileDir(const QString &file)
QString ResultsTree::askFileDir(const QString &file)
{
QString text = tr("Could not find file:\n%1\nPlease select the directory where file is located.").arg(file);
QMessageBox msgbox(this);
@ -749,17 +749,17 @@ QString ResultsTree::AskFileDir(const QString &file)
return dir;
}
void ResultsTree::CopyFilename()
void ResultsTree::copyFilename()
{
CopyPathToClipboard(mContextItem, false);
copyPathToClipboard(mContextItem, false);
}
void ResultsTree::CopyFullPath()
void ResultsTree::copyFullPath()
{
CopyPathToClipboard(mContextItem, true);
copyPathToClipboard(mContextItem, true);
}
void ResultsTree::CopyMessage()
void ResultsTree::copyMessage()
{
if (mContextItem) {
// Make sure we are working with the first column
@ -780,7 +780,7 @@ void ResultsTree::CopyMessage()
}
}
void ResultsTree::CopyMessageId()
void ResultsTree::copyMessageId()
{
if (mContextItem) {
// Make sure we are working with the first column
@ -795,7 +795,7 @@ void ResultsTree::CopyMessageId()
}
}
void ResultsTree::HideResult()
void ResultsTree::hideResult()
{
if (!mSelectionModel)
return;
@ -808,12 +808,12 @@ void ResultsTree::HideResult()
data["hide"] = true;
item->setData(QVariant(data));
RefreshTree();
emit ResultsHidden(true);
refreshTree();
emit resultsHidden(true);
}
}
void ResultsTree::RecheckSelectedFiles()
void ResultsTree::recheckSelectedFiles()
{
if (!mSelectionModel)
return;
@ -835,7 +835,7 @@ void ResultsTree::RecheckSelectedFiles()
fileNameWithCheckPath = currentFile;
const QFileInfo fileInfo(fileNameWithCheckPath);
if (!fileInfo.exists()) {
AskFileDir(currentFile);
askFileDir(currentFile);
return;
}
if (Path::isHeader(currentFile.toStdString())) {
@ -848,10 +848,10 @@ void ResultsTree::RecheckSelectedFiles()
selectedItems<<fileNameWithCheckPath;
}
}
emit CheckSelected(selectedItems);
emit checkSelected(selectedItems);
}
void ResultsTree::HideAllIdResult()
void ResultsTree::hideAllIdResult()
{
if (mContextItem && mContextItem->parent()) {
// Make sure we are working with the first column
@ -888,37 +888,37 @@ void ResultsTree::HideAllIdResult()
}
}
RefreshTree();
emit ResultsHidden(true);
refreshTree();
emit resultsHidden(true);
}
}
void ResultsTree::OpenContainingFolder()
void ResultsTree::openContainingFolder()
{
QString filePath = GetFilePath(mContextItem, true);
QString filePath = getFilePath(mContextItem, true);
if (!filePath.isEmpty()) {
filePath = QFileInfo(filePath).absolutePath();
QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
}
}
void ResultsTree::Context(int application)
void ResultsTree::context(int application)
{
StartApplication(mContextItem, application);
startApplication(mContextItem, application);
}
void ResultsTree::QuickStartApplication(const QModelIndex &index)
void ResultsTree::quickStartApplication(const QModelIndex &index)
{
StartApplication(mModel.itemFromIndex(index));
startApplication(mModel.itemFromIndex(index));
}
void ResultsTree::CopyPathToClipboard(QStandardItem *target, bool fullPath)
void ResultsTree::copyPathToClipboard(QStandardItem *target, bool fullPath)
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(GetFilePath(target, fullPath));
clipboard->setText(getFilePath(target, fullPath));
}
QString ResultsTree::GetFilePath(QStandardItem *target, bool fullPath)
QString ResultsTree::getFilePath(QStandardItem *target, bool fullPath)
{
if (target) {
// Make sure we are working with the first column
@ -942,7 +942,7 @@ QString ResultsTree::GetFilePath(QStandardItem *target, bool fullPath)
return QString();
}
QString ResultsTree::SeverityToIcon(Severity::SeverityType severity) const
QString ResultsTree::severityToIcon(Severity::SeverityType severity) const
{
switch (severity) {
case Severity::error:
@ -962,20 +962,20 @@ QString ResultsTree::SeverityToIcon(Severity::SeverityType severity) const
}
}
void ResultsTree::SaveResults(Report *report) const
void ResultsTree::saveResults(Report *report) const
{
report->writeHeader();
for (int i = 0; i < mModel.rowCount(); i++) {
QStandardItem *item = mModel.item(i, 0);
if (!isRowHidden(i, QModelIndex()))
SaveErrors(report, item);
saveErrors(report, item);
}
report->writeFooter();
}
void ResultsTree::SaveErrors(Report *report, QStandardItem *item) const
void ResultsTree::saveErrors(Report *report, QStandardItem *item) const
{
if (!item) {
return;
@ -1007,7 +1007,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item) const
if (error->rowCount() == 0) {
QErrorPathItem e;
e.file = StripPath(data["file"].toString(), true);
e.file = stripPath(data["file"].toString(), true);
e.line = data["line"].toUInt();
e.info = data["message"].toString();
item.errorPath << e;
@ -1021,7 +1021,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item) const
QVariantMap child_data = child_userdata.toMap();
QErrorPathItem e;
e.file = StripPath(child_data["file"].toString(), true);
e.file = stripPath(child_data["file"].toString(), true);
e.line = child_data["line"].toUInt();
e.info = child_data["message"].toString();
item.errorPath << e;
@ -1031,7 +1031,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item) const
}
}
void ResultsTree::UpdateSettings(bool showFullPath,
void ResultsTree::updateSettings(bool showFullPath,
bool saveFullPath,
bool saveAllErrors,
bool showErrorId,
@ -1039,28 +1039,28 @@ void ResultsTree::UpdateSettings(bool showFullPath,
{
if (mShowFullPath != showFullPath) {
mShowFullPath = showFullPath;
RefreshFilePaths();
refreshFilePaths();
}
mSaveFullPath = saveFullPath;
mSaveAllErrors = saveAllErrors;
ShowIdColumn(showErrorId);
ShowInconclusiveColumn(showInconclusive);
showIdColumn(showErrorId);
showInconclusiveColumn(showInconclusive);
}
void ResultsTree::SetCheckDirectory(const QString &dir)
void ResultsTree::setCheckDirectory(const QString &dir)
{
mCheckPath = dir;
}
QString ResultsTree::GetCheckDirectory(void)
QString ResultsTree::getCheckDirectory(void)
{
return mCheckPath;
}
QString ResultsTree::StripPath(const QString &path, bool saving) const
QString ResultsTree::stripPath(const QString &path, bool saving) const
{
if ((!saving && mShowFullPath) || (saving && mSaveFullPath)) {
return QString(path);
@ -1070,7 +1070,7 @@ QString ResultsTree::StripPath(const QString &path, bool saving) const
return dir.relativeFilePath(path);
}
void ResultsTree::RefreshFilePaths(QStandardItem *item)
void ResultsTree::refreshFilePaths(QStandardItem *item)
{
if (!item) {
return;
@ -1097,7 +1097,7 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item)
QString file = data["file"].toString();
//Update this error's text
error->setText(StripPath(file, false));
error->setText(stripPath(file, false));
//If this error has backtraces make sure the files list has enough filenames
if (error->hasChildren()) {
@ -1116,7 +1116,7 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item)
//Get list of files
QString child_files = child_data["file"].toString();
//Update file's path
child->setText(StripPath(child_files, false));
child->setText(stripPath(child_files, false));
}
}
@ -1129,27 +1129,27 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item)
}
}
void ResultsTree::RefreshFilePaths()
void ResultsTree::refreshFilePaths()
{
qDebug("Refreshing file paths");
//Go through all file items (these are parent items that contain the errors)
for (int i = 0; i < mModel.rowCount(); i++) {
RefreshFilePaths(mModel.item(i, 0));
refreshFilePaths(mModel.item(i, 0));
}
}
bool ResultsTree::HasVisibleResults() const
bool ResultsTree::hasVisibleResults() const
{
return mVisibleErrors;
}
bool ResultsTree::HasResults() const
bool ResultsTree::hasResults() const
{
return mModel.rowCount() > 0;
}
void ResultsTree::Translate()
void ResultsTree::translate()
{
QStringList labels;
labels << tr("File") << tr("Severity") << tr("Line") << tr("Id") << tr("Inconclusive") << tr("Summary");
@ -1157,7 +1157,7 @@ void ResultsTree::Translate()
//TODO go through all the errors in the tree and translate severity and message
}
void ResultsTree::ShowIdColumn(bool show)
void ResultsTree::showIdColumn(bool show)
{
mShowErrorId = show;
if (show)
@ -1166,7 +1166,7 @@ void ResultsTree::ShowIdColumn(bool show)
hideColumn(3);
}
void ResultsTree::ShowInconclusiveColumn(bool show)
void ResultsTree::showInconclusiveColumn(bool show)
{
if (show)
showColumn(4);
@ -1177,5 +1177,5 @@ void ResultsTree::ShowInconclusiveColumn(bool show)
void ResultsTree::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
QTreeView::currentChanged(current, previous);
emit SelectionChanged(current);
emit selectionChanged(current);
}

View File

@ -50,30 +50,30 @@ class ResultsTree : public QTreeView {
public:
explicit ResultsTree(QWidget * parent = 0);
virtual ~ResultsTree();
void Initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);
/**
* @brief Add a new item to the tree
*
* @param item Error item data
*/
bool AddErrorItem(const ErrorItem &item);
bool addErrorItem(const ErrorItem &item);
/**
* @brief Clear all errors from the tree
*
*/
void Clear();
void clear();
/**
* @brief Clear errors for a specific file from the tree
*/
void Clear(const QString &filename);
void clear(const QString &filename);
/**
* @brief Clear errors of a file selected for recheck
*/
void ClearRecheckFile(const QString &filename);
void clearRecheckFile(const QString &filename);
/**
* @brief Function to show/hide certain type of errors
@ -82,7 +82,7 @@ public:
* @param type Type of error to show/hide
* @param show Should specified errors be shown (true) or hidden (false)
*/
void ShowResults(ShowTypes::ShowType type, bool show);
void showResults(ShowTypes::ShowType type, bool show);
/**
* @brief Function to filter the displayed list of errors.
@ -90,18 +90,18 @@ public:
*
* @param filter String that must be found in the summary, description, file or id
*/
void FilterResults(const QString& filter);
void filterResults(const QString& filter);
/**
* @brief Function to show results that were previous hidden with HideResult()
*/
void ShowHiddenResults();
void showHiddenResults();
/**
* @brief Save results to a text stream
*
*/
void SaveResults(Report *report) const;
void saveResults(Report *report) const;
/**
* @brief Update tree settings
@ -112,7 +112,7 @@ public:
* @param showErrorId Show error id
* @param showInconclusive Show inconclusive column
*/
void UpdateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showErrorId, bool showInconclusive);
void updateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showErrorId, bool showInconclusive);
/**
* @brief Set the directory we are checking
@ -120,7 +120,7 @@ public:
* This is used to split error file path to relative if necessary
* @param dir Directory we are checking
*/
void SetCheckDirectory(const QString &dir);
void setCheckDirectory(const QString &dir);
/**
* @brief Get the directory we are checking
@ -128,46 +128,46 @@ public:
* @return Directory containing source files
*/
QString GetCheckDirectory(void);
QString getCheckDirectory(void);
/**
* @brief Check if there are any visible results in view.
* @return true if there is at least one visible warning/error.
*/
bool HasVisibleResults() const;
bool hasVisibleResults() const;
/**
* @brief Do we have results from check?
* @return true if there is at least one warning/error, hidden or visible.
*/
bool HasResults() const;
bool hasResults() const;
/**
* @brief Save all settings
* Column widths
*/
void SaveSettings() const;
void saveSettings() const;
/**
* @brief Change all visible texts language
*
*/
void Translate();
void translate();
/**
* @brief Show optional column "Id"
*/
void ShowIdColumn(bool show);
void showIdColumn(bool show);
/**
* @brief Show optional column "Inconclusve"
*/
void ShowInconclusiveColumn(bool show);
void showInconclusiveColumn(bool show);
/**
* @brief Returns true if column "Id" is shown
*/
bool ShowIdColumn() const {
bool showIdColumn() const {
return mShowErrorId;
}
@ -184,21 +184,21 @@ signals:
*
* @param hidden true if there are some hidden results, or false if there are not
*/
void ResultsHidden(bool hidden);
void resultsHidden(bool hidden);
/**
* @brief Signal to perform selected files recheck
*
* @param selectedItems list of selected files
*/
void CheckSelected(QStringList selectedItems);
void checkSelected(QStringList selectedItems);
/**
* @brief Signal for selection change in result tree.
*
* @param current Model index to specify new selected item.
*/
void SelectionChanged(const QModelIndex &current);
void selectionChanged(const QModelIndex &current);
protected slots:
/**
@ -206,61 +206,61 @@ protected slots:
*
* @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
*
* @param application Index of the application to open the error
*/
void Context(int application);
void context(int application);
/**
* @brief Slot for context menu item to copy filename to clipboard
*
*/
void CopyFilename();
void copyFilename();
/**
* @brief Slot for context menu item to copy full path to clipboard
*
*/
void CopyFullPath();
void copyFullPath();
/**
* @brief Slot for context menu item to the current error message to clipboard
*
*/
void CopyMessage();
void copyMessage();
/**
* @brief Slot for context menu item to the current error message Id to clipboard
*
*/
void CopyMessageId();
void copyMessageId();
/**
* @brief Slot for context menu item to hide the current error message
*
*/
void HideResult();
void hideResult();
/**
* @brief Slot for rechecking selected files
*
*/
void RecheckSelectedFiles();
void recheckSelectedFiles();
/**
* @brief Slot for context menu item to hide all messages with the current message Id
*
*/
void HideAllIdResult();
void hideAllIdResult();
/**
* @brief Slot for context menu item to open the folder containing the current file.
*/
void OpenContainingFolder();
void openContainingFolder();
/**
* @brief Slot for selection change in the results tree.
@ -276,13 +276,13 @@ protected:
* @brief Hides/shows full file path on all error file items according to mShowFullPath
*
*/
void RefreshFilePaths();
void refreshFilePaths();
/**
* @brief Hides/shows full file path on all error file items according to mShowFullPath
* @param item Parent item whose childrens paths to change
*/
void RefreshFilePaths(QStandardItem *item);
void refreshFilePaths(QStandardItem *item);
/**
@ -292,7 +292,7 @@ protected:
* @param saving are we saving? Check mSaveFullPath instead
* @return Path that has checking directory removed
*/
QString StripPath(const QString &path, bool saving) const;
QString stripPath(const QString &path, bool saving) const;
/**
@ -300,14 +300,14 @@ protected:
* @param report Report that errors are saved to
* @param item Item whose errors to save
*/
void SaveErrors(Report *report, QStandardItem *item) const;
void saveErrors(Report *report, QStandardItem *item) const;
/**
* @brief Convert a severity string to a icon filename
*
* @param severity Severity
*/
QString SeverityToIcon(Severity::SeverityType severity) const;
QString severityToIcon(Severity::SeverityType severity) const;
/**
* @brief Helper function to open an error within target with application*
@ -316,7 +316,7 @@ protected:
* @param application Index of the application to open with. Giving -1
* (default value) will open the default application.
*/
void StartApplication(QStandardItem *target, int application = -1);
void startApplication(QStandardItem *target, int application = -1);
/**
* @brief Helper function to copy filename/full path to the clipboard
@ -324,7 +324,7 @@ protected:
* @param target Error tree item to open
* @param fullPath Are we copying full path or only filename?
*/
void CopyPathToClipboard(QStandardItem *target, bool fullPath);
void copyPathToClipboard(QStandardItem *target, bool fullPath);
/**
* @brief Helper function returning the filename/full path of the error tree item \a target.
@ -332,7 +332,7 @@ protected:
* @param target The error tree item containing the filename/full path
* @param fullPath Whether or not to retrieve the full path or only the filename.
*/
QString GetFilePath(QStandardItem *target, bool fullPath);
QString getFilePath(QStandardItem *target, bool fullPath);
/**
* @brief Context menu event (user right clicked on the tree)
@ -351,7 +351,7 @@ protected:
* @param childOfMessage Is this a child element of a message?
* @return newly created QStandardItem *
*/
QStandardItem *AddBacktraceFiles(QStandardItem *parent,
QStandardItem *addBacktraceFiles(QStandardItem *parent,
const ErrorLine &item,
const bool hide,
const QString &icon,
@ -363,27 +363,27 @@ protected:
* and which should be hidden
*
*/
void RefreshTree();
void refreshTree();
/**
* @brief Convert Severity to translated string for GUI.
* @param severity Severity to convert
* @return Severity as translated string
*/
static QString SeverityToTranslatedString(Severity::SeverityType severity);
static QString severityToTranslatedString(Severity::SeverityType severity);
/**
* @brief Load all settings
* Column widths
*/
void LoadSettings();
void loadSettings();
/**
* @brief Ask directory where file is located.
* @param file File name.
* @return Directory user chose.
*/
QString AskFileDir(const QString &file);
QString askFileDir(const QString &file);
/**
* @brief Create new normal item.
@ -392,7 +392,7 @@ protected:
* @param name name for the item
* @return new QStandardItem
*/
static QStandardItem *CreateNormalItem(const QString &name);
static QStandardItem *createNormalItem(const QString &name);
/**
* @brief Create new normal item.
@ -401,7 +401,7 @@ protected:
* @param checked checked
* @return new QStandardItem
*/
static QStandardItem *CreateCheckboxItem(bool checked);
static QStandardItem *createCheckboxItem(bool checked);
/**
* @brief Create new line number item.
@ -410,7 +410,7 @@ protected:
* @param linenumber name for the item
* @return new QStandardItem
*/
static QStandardItem *CreateLineNumberItem(const QString &linenumber);
static QStandardItem *createLineNumberItem(const QString &linenumber);
/**
* @brief Finds a file item
@ -418,7 +418,7 @@ protected:
* @param name name of the file item to find
* @return pointer to file item or null if none found
*/
QStandardItem *FindFileItem(const QString &name) const;
QStandardItem *findFileItem(const QString &name) const;
/**
@ -429,7 +429,7 @@ protected:
* @param hide is the error (we want this file item for) hidden?
* @return QStandardItem to be used as a parent for all errors for specified file
*/
QStandardItem *EnsureFileItem(const QString &fullpath, const QString &file0, bool hide);
QStandardItem *ensureFileItem(const QString &fullpath, const QString &file0, bool hide);
/**
* @brief Item model for tree

View File

@ -48,9 +48,9 @@ ResultsView::ResultsView(QWidget * parent) :
{
mUI.setupUi(this);
connect(mUI.mTree, SIGNAL(ResultsHidden(bool)), this, SIGNAL(ResultsHidden(bool)));
connect(mUI.mTree, SIGNAL(CheckSelected(QStringList)), this, SIGNAL(CheckSelected(QStringList)));
connect(mUI.mTree, SIGNAL(SelectionChanged(const QModelIndex &)), this, SLOT(UpdateDetails(const QModelIndex &)));
connect(mUI.mTree, SIGNAL(resultsHidden(bool)), this, SIGNAL(ResultsHidden(bool)));
connect(mUI.mTree, SIGNAL(checkSelected(QStringList)), this, SIGNAL(CheckSelected(QStringList)));
connect(mUI.mTree, SIGNAL(selectionChanged(const QModelIndex &)), this, SLOT(UpdateDetails(const QModelIndex &)));
}
void ResultsView::Initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
@ -62,7 +62,7 @@ void ResultsView::Initialize(QSettings *settings, ApplicationList *list, ThreadH
mUI.mVerticalSplitter->restoreState(state);
mShowNoErrorsMessage = settings->value(SETTINGS_SHOW_NO_ERRORS, true).toBool();
mUI.mTree->Initialize(settings, list, checkThreadHandler);
mUI.mTree->initialize(settings, list, checkThreadHandler);
}
ResultsView::~ResultsView()
@ -73,7 +73,7 @@ ResultsView::~ResultsView()
void ResultsView::Clear(bool results)
{
if (results) {
mUI.mTree->Clear();
mUI.mTree->clear();
}
mUI.mDetails->setText("");
@ -88,12 +88,12 @@ void ResultsView::Clear(bool results)
void ResultsView::Clear(const QString &filename)
{
mUI.mTree->Clear(filename);
mUI.mTree->clear(filename);
}
void ResultsView::ClearRecheckFile(const QString &filename)
{
mUI.mTree->ClearRecheckFile(filename);
mUI.mTree->clearRecheckFile(filename);
}
void ResultsView::Progress(int value, const QString& description)
@ -104,7 +104,7 @@ void ResultsView::Progress(int value, const QString& description)
void ResultsView::Error(const ErrorItem &item)
{
if (mUI.mTree->AddErrorItem(item)) {
if (mUI.mTree->addErrorItem(item)) {
emit GotResults();
mStatistics->addItem(ShowTypes::SeverityToShowType(item.severity));
}
@ -112,7 +112,7 @@ void ResultsView::Error(const ErrorItem &item)
void ResultsView::ShowResults(ShowTypes::ShowType type, bool show)
{
mUI.mTree->ShowResults(type, show);
mUI.mTree->showResults(type, show);
}
void ResultsView::CollapseAllResults()
@ -127,12 +127,12 @@ void ResultsView::ExpandAllResults()
void ResultsView::ShowHiddenResults()
{
mUI.mTree->ShowHiddenResults();
mUI.mTree->showHiddenResults();
}
void ResultsView::FilterResults(const QString& filter)
{
mUI.mTree->FilterResults(filter);
mUI.mTree->filterResults(filter);
}
void ResultsView::Save(const QString &filename, Report::Type type) const
@ -163,7 +163,7 @@ void ResultsView::Save(const QString &filename, Report::Type type) const
if (report) {
if (report->create())
mUI.mTree->SaveResults(report);
mUI.mTree->saveResults(report);
else {
QMessageBox msgBox;
msgBox.setText(tr("Failed to save the report."));
@ -210,7 +210,7 @@ void ResultsView::Print(QPrinter* printer)
}
PrintableReport report;
mUI.mTree->SaveResults(&report);
mUI.mTree->saveResults(&report);
QTextDocument doc(report.getFormattedReportText());
doc.print(printer);
}
@ -222,18 +222,18 @@ void ResultsView::UpdateSettings(bool showFullPath,
bool showErrorId,
bool showInconclusive)
{
mUI.mTree->UpdateSettings(showFullPath, saveFullPath, saveAllErrors, showErrorId, showInconclusive);
mUI.mTree->updateSettings(showFullPath, saveFullPath, saveAllErrors, showErrorId, showInconclusive);
mShowNoErrorsMessage = showNoErrorsMessage;
}
void ResultsView::SetCheckDirectory(const QString &dir)
{
mUI.mTree->SetCheckDirectory(dir);
mUI.mTree->setCheckDirectory(dir);
}
QString ResultsView::GetCheckDirectory(void)
{
return mUI.mTree->GetCheckDirectory();
return mUI.mTree->getCheckDirectory();
}
void ResultsView::CheckingStarted(int count)
@ -261,7 +261,7 @@ void ResultsView::CheckingFinished()
msg.exec();
} //If we have errors but they aren't visible, tell user about it
else if (!mUI.mTree->HasVisibleResults()) {
else if (!mUI.mTree->hasVisibleResults()) {
QString text = tr("Errors were found, but they are configured to be hidden.\n"\
"To toggle what kind of errors are shown, open view menu.");
QMessageBox msg(QMessageBox::Information,
@ -277,17 +277,17 @@ void ResultsView::CheckingFinished()
bool ResultsView::HasVisibleResults() const
{
return mUI.mTree->HasVisibleResults();
return mUI.mTree->hasVisibleResults();
}
bool ResultsView::HasResults() const
{
return mUI.mTree->HasResults();
return mUI.mTree->hasResults();
}
void ResultsView::SaveSettings(QSettings *settings)
{
mUI.mTree->SaveSettings();
mUI.mTree->saveSettings();
QByteArray state = mUI.mVerticalSplitter->saveState();
settings->setValue(SETTINGS_MAINWND_SPLITTER_STATE, state);
mUI.mVerticalSplitter->restoreState(state);
@ -295,7 +295,7 @@ void ResultsView::SaveSettings(QSettings *settings)
void ResultsView::Translate()
{
mUI.mTree->Translate();
mUI.mTree->translate();
}
void ResultsView::DisableProgressbar()
@ -341,9 +341,9 @@ void ResultsView::ReadErrorsXml(const QString &filename)
ErrorItem item;
foreach (item, errors) {
mUI.mTree->AddErrorItem(item);
mUI.mTree->addErrorItem(item);
}
mUI.mTree->SetCheckDirectory("");
mUI.mTree->setCheckDirectory("");
}
void ResultsView::UpdateDetails(const QModelIndex &index)
@ -378,7 +378,7 @@ void ResultsView::UpdateDetails(const QModelIndex &index)
if (file0 != "" && Path::isHeader(data["file"].toString().toStdString()))
formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0));
if (mUI.mTree->ShowIdColumn())
if (mUI.mTree->showIdColumn())
formattedMsg.prepend(tr("Id") + ": " + data["id"].toString() + "\n");
mUI.mDetails->setText(formattedMsg);
}