From 66ffb01629a34a70fbb571763842600c771d0adc Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 26 Sep 2018 23:48:19 +0800 Subject: [PATCH 1/3] Add include guard to headers --- src/base/unicodestrings.h | 2 ++ src/gui/categoryfilterwidget.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/base/unicodestrings.h b/src/base/unicodestrings.h index 88ffe7782..9f44b1192 100644 --- a/src/base/unicodestrings.h +++ b/src/base/unicodestrings.h @@ -26,6 +26,8 @@ * exception statement from your version. */ +#pragma once + // This file must be encoded in "UTF-8 with BOM" #ifdef _MSC_VER #pragma execution_character_set("utf-8") diff --git a/src/gui/categoryfilterwidget.h b/src/gui/categoryfilterwidget.h index 0c93a5ffb..da9af5dca 100644 --- a/src/gui/categoryfilterwidget.h +++ b/src/gui/categoryfilterwidget.h @@ -26,7 +26,9 @@ * exception statement from your version. */ - #include +#pragma once + +#include class CategoryFilterWidget : public QTreeView { From b8d87f641fc27771404581924f87957581d9b374 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 26 Sep 2018 23:52:47 +0800 Subject: [PATCH 2/3] Avoid variable shadowing --- src/base/search/searchpluginmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/search/searchpluginmanager.cpp b/src/base/search/searchpluginmanager.cpp index 8915fbe71..ebb54a6f6 100644 --- a/src/base/search/searchpluginmanager.cpp +++ b/src/base/search/searchpluginmanager.cpp @@ -145,8 +145,8 @@ QStringList SearchPluginManager::getPluginCategories(const QString &pluginName) plugins << pluginName.trimmed(); QSet categories; - for (const QString &pluginName : qAsConst(plugins)) { - const PluginInfo *plugin = pluginInfo(pluginName); + for (const QString &name : qAsConst(plugins)) { + const PluginInfo *plugin = pluginInfo(name); if (!plugin) continue; // plugin wasn't found for (const QString &category : plugin->supportedCategories) categories << category; From 43fbf8ab3b5b99dc50f4d17ec4f91747e9b5d611 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 27 Sep 2018 00:10:11 +0800 Subject: [PATCH 3/3] Remove default parameter in derived function When derived function have different default value than base, it might cause unnecessary confusion, see: https://stackoverflow.com/q/3533589 --- src/gui/transferlistmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/transferlistmodel.h b/src/gui/transferlistmodel.h index 3766a6797..618d33331 100644 --- a/src/gui/transferlistmodel.h +++ b/src/gui/transferlistmodel.h @@ -86,7 +86,7 @@ public: int rowCount(const QModelIndex& index = QModelIndex()) const override; int columnCount(const QModelIndex &parent=QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole) override; + bool setData(const QModelIndex &index, const QVariant &value, int role) override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; Qt::ItemFlags flags(const QModelIndex &index) const override;