Clang-Tidy and Clazy fixes

This commit is contained in:
Jonas Kvinge
2021-06-20 19:04:08 +02:00
parent 755abec636
commit 1295033fae
374 changed files with 1304 additions and 900 deletions

View File

@@ -51,7 +51,7 @@ GlobalShortcut::GlobalShortcut(QObject *parent) : QObject(parent),
}
GlobalShortcut::GlobalShortcut(QKeySequence shortcut, GlobalShortcutsBackend *backend, QObject *parent) : QObject(parent),
GlobalShortcut::GlobalShortcut(const QKeySequence &shortcut, GlobalShortcutsBackend *backend, QObject *parent) : QObject(parent),
backend_(backend),
shortcut_(shortcut),
qt_key_(Qt::Key(0)),

View File

@@ -39,7 +39,7 @@ class GlobalShortcut : public QObject, QAbstractNativeEventFilter {
public:
explicit GlobalShortcut(QObject *parent = nullptr);
explicit GlobalShortcut(QKeySequence shortcut, GlobalShortcutsBackend *backend, QObject *parent = nullptr);
explicit GlobalShortcut(const QKeySequence &shortcut, GlobalShortcutsBackend *backend, QObject *parent = nullptr);
~GlobalShortcut() override;
GlobalShortcutsBackend *backend() const { return backend_; }

View File

@@ -42,8 +42,8 @@ const char *GlobalShortcutsBackendGnome::kService1 = "org.gnome.SettingsDaemon.M
const char *GlobalShortcutsBackendGnome::kService2 = "org.gnome.SettingsDaemon";
const char *GlobalShortcutsBackendGnome::kPath = "/org/gnome/SettingsDaemon/MediaKeys";
GlobalShortcutsBackendGnome::GlobalShortcutsBackendGnome(GlobalShortcutsManager *parent)
: GlobalShortcutsBackend(parent),
GlobalShortcutsBackendGnome::GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent),
interface_(nullptr),
is_connected_(false) {}

View File

@@ -37,7 +37,7 @@ class GlobalShortcutsBackendGnome : public GlobalShortcutsBackend {
Q_OBJECT
public:
explicit GlobalShortcutsBackendGnome(GlobalShortcutsManager *parent);
explicit GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent = nullptr);
bool IsAvailable() override;

View File

@@ -41,7 +41,7 @@
const char *GlobalShortcutsBackendKDE::kKdeService = "org.kde.kglobalaccel";
const char *GlobalShortcutsBackendKDE::kKdePath = "/kglobalaccel";
GlobalShortcutsBackendKDE::GlobalShortcutsBackendKDE(GlobalShortcutsManager *parent) : GlobalShortcutsBackend(parent), interface_(nullptr), component_(nullptr) {}
GlobalShortcutsBackendKDE::GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent) : GlobalShortcutsBackend(manager, parent), interface_(nullptr), component_(nullptr) {}
bool GlobalShortcutsBackendKDE::IsAvailable() {
@@ -174,6 +174,7 @@ QStringList GlobalShortcutsBackendKDE::GetActionId(const QString &id, const QAct
QList<int> GlobalShortcutsBackendKDE::ToIntList(const QList<QKeySequence> &sequence_list) {
QList<int> ret;
ret.reserve(sequence_list.count());
for (const QKeySequence &sequence : sequence_list) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
ret.append(sequence[0].toCombined());
@@ -189,6 +190,7 @@ QList<int> GlobalShortcutsBackendKDE::ToIntList(const QList<QKeySequence> &seque
QList<QKeySequence> GlobalShortcutsBackendKDE::ToKeySequenceList(const QList<int> &sequence_list) {
QList<QKeySequence> ret;
ret.reserve(sequence_list.count());
for (int sequence : sequence_list) {
ret.append(sequence);
}

View File

@@ -41,7 +41,7 @@ class GlobalShortcutsBackendKDE : public GlobalShortcutsBackend {
Q_OBJECT
public:
explicit GlobalShortcutsBackendKDE(GlobalShortcutsManager *parent);
explicit GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent = nullptr);
bool IsAvailable() override;

View File

@@ -40,7 +40,7 @@ class GlobalShortcutsBackendMacOS : public GlobalShortcutsBackend {
Q_OBJECT
public:
explicit GlobalShortcutsBackendMacOS(GlobalShortcutsManager* parent);
explicit GlobalShortcutsBackendMacOS(GlobalShortcutsManager *manager, QObject *parent = nullptr);
virtual ~GlobalShortcutsBackendMacOS();
bool IsAvailable() override { return true; }

View File

@@ -77,8 +77,8 @@ class GlobalShortcutsBackendMacOSPrivate : boost::noncopyable {
GlobalShortcutsBackendMacOS *backend_;
};
GlobalShortcutsBackendMacOS::GlobalShortcutsBackendMacOS(GlobalShortcutsManager *parent)
: GlobalShortcutsBackend(parent),
GlobalShortcutsBackendMacOS::GlobalShortcutsBackendMacOS(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent),
p_(new GlobalShortcutsBackendMacOSPrivate(this)) {}
GlobalShortcutsBackendMacOS::~GlobalShortcutsBackendMacOS() {}

View File

@@ -40,8 +40,8 @@ const char *GlobalShortcutsBackendMate::kService1 = "org.mate.SettingsDaemon.Med
const char *GlobalShortcutsBackendMate::kService2 = "org.mate.SettingsDaemon";
const char *GlobalShortcutsBackendMate::kPath = "/org/mate/SettingsDaemon/MediaKeys";
GlobalShortcutsBackendMate::GlobalShortcutsBackendMate(GlobalShortcutsManager *parent)
: GlobalShortcutsBackend(parent),
GlobalShortcutsBackendMate::GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent),
interface_(nullptr),
is_connected_(false) {}

View File

@@ -35,7 +35,7 @@ class GlobalShortcutsBackendMate : public GlobalShortcutsBackend {
Q_OBJECT
public:
explicit GlobalShortcutsBackendMate(GlobalShortcutsManager *parent);
explicit GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent = nullptr);
bool IsAvailable() override;

View File

@@ -33,9 +33,9 @@
#include "globalshortcutsbackend.h"
#include "globalshortcut.h"
GlobalShortcutsBackendSystem::GlobalShortcutsBackendSystem(GlobalShortcutsManager *parent) : GlobalShortcutsBackend(parent), gshortcut_init_(nullptr) {}
GlobalShortcutsBackendSystem::GlobalShortcutsBackendSystem(GlobalShortcutsManager *manager, QObject *parent) : GlobalShortcutsBackend(manager, parent), gshortcut_init_(nullptr) {}
GlobalShortcutsBackendSystem::~GlobalShortcutsBackendSystem() { DoUnregister(); }
GlobalShortcutsBackendSystem::~GlobalShortcutsBackendSystem() { GlobalShortcutsBackendSystem::DoUnregister(); }
bool GlobalShortcutsBackendSystem::DoRegister() {

View File

@@ -38,7 +38,7 @@ class GlobalShortcutsBackendSystem : public GlobalShortcutsBackend {
Q_OBJECT
public:
explicit GlobalShortcutsBackendSystem(GlobalShortcutsManager *parent = nullptr);
explicit GlobalShortcutsBackendSystem(GlobalShortcutsManager *manager, QObject *parent = nullptr);
~GlobalShortcutsBackendSystem() override;
bool IsAvailable() override { return true; }

View File

@@ -25,8 +25,8 @@
#include "globalshortcutsbackend.h"
#include "globalshortcutsmanager.h"
GlobalShortcutsBackend::GlobalShortcutsBackend(GlobalShortcutsManager *parent)
: QObject(parent), manager_(parent), active_(false) {}
GlobalShortcutsBackend::GlobalShortcutsBackend(GlobalShortcutsManager *manager, QObject *parent)
: QObject(parent), manager_(manager), active_(false) {}
bool GlobalShortcutsBackend::Register() {
bool ret = DoRegister();

View File

@@ -32,7 +32,7 @@ class GlobalShortcutsBackend : public QObject {
Q_OBJECT
public:
explicit GlobalShortcutsBackend(GlobalShortcutsManager *parent = nullptr);
explicit GlobalShortcutsBackend(GlobalShortcutsManager *manager, QObject *parent = nullptr);
bool is_active() const { return active_; }

View File

@@ -123,7 +123,7 @@ void GlobalShortcutsManager::ReloadSettings() {
}
void GlobalShortcutsManager::AddShortcut(const QString &id, const QString &name, std::function<void()> signal, const QKeySequence &default_key) {
void GlobalShortcutsManager::AddShortcut(const QString &id, const QString &name, std::function<void()> signal, const QKeySequence &default_key) { // clazy:exclude=function-args-by-ref
Shortcut shortcut = AddShortcut(id, name, default_key);
QObject::connect(shortcut.action, &QAction::triggered, this, signal);

View File

@@ -39,7 +39,7 @@
#endif
namespace KeyMapperX11 {
static const QMap<Qt::Key, quint32> keymapper_x11_ = {
static const QMap<Qt::Key, quint32> keymapper_x11_ = { // clazy:exclude=non-pod-global-static
#ifdef HAVE_KEYSYMDEF_H