Use C++11 enum class

This commit is contained in:
Jonas Kvinge
2023-02-18 14:09:27 +01:00
parent e6c5f76872
commit dd72fb4ca5
237 changed files with 2915 additions and 2840 deletions

View File

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

View File

@@ -42,7 +42,7 @@ const char *GlobalShortcutsBackendKDE::kKdeService = "org.kde.kglobalaccel";
const char *GlobalShortcutsBackendKDE::kKdePath = "/kglobalaccel";
GlobalShortcutsBackendKDE::GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_KDE, parent),
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::KDE, parent),
interface_(nullptr),
component_(nullptr) {}

View File

@@ -76,7 +76,7 @@ class GlobalShortcutsBackendMacOSPrivate : boost::noncopyable {
};
GlobalShortcutsBackendMacOS::GlobalShortcutsBackendMacOS(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_MacOS, parent),
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::macOS, parent),
p_(new GlobalShortcutsBackendMacOSPrivate(this)) {}
GlobalShortcutsBackendMacOS::~GlobalShortcutsBackendMacOS() {}

View File

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

View File

@@ -34,7 +34,7 @@
#include "globalshortcut.h"
GlobalShortcutsBackendWin::GlobalShortcutsBackendWin(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_Win, parent),
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::Win, parent),
gshortcut_init_(nullptr) {}
GlobalShortcutsBackendWin::~GlobalShortcutsBackendWin() {

View File

@@ -34,7 +34,7 @@
#include "globalshortcut.h"
GlobalShortcutsBackendX11::GlobalShortcutsBackendX11(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_X11, parent),
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::X11, parent),
gshortcut_init_(nullptr) {}
GlobalShortcutsBackendX11::~GlobalShortcutsBackendX11() { GlobalShortcutsBackendX11::DoUnregister(); }

View File

@@ -34,19 +34,19 @@ GlobalShortcutsBackend::GlobalShortcutsBackend(GlobalShortcutsManager *manager,
QString GlobalShortcutsBackend::name() const {
switch (type_) {
case Type_None:
case Type::None:
return "None";
case Type_KDE:
case Type::KDE:
return "KDE";
case Type_Gnome:
case Type::Gnome:
return "Gnome";
case Type_Mate:
case Type::Mate:
return "Mate";
case Type_X11:
case Type::X11:
return "X11";
case Type_MacOS:
case Type::macOS:
return "macOS";
case Type_Win:
case Type::Win:
return "Windows";
}

View File

@@ -32,14 +32,14 @@ class GlobalShortcutsBackend : public QObject {
Q_OBJECT
public:
enum Type {
Type_None = 0,
Type_KDE,
Type_Gnome,
Type_Mate,
Type_X11,
Type_MacOS,
Type_Win
enum class Type {
None = 0,
KDE,
Gnome,
Mate,
X11,
macOS,
Win
};
explicit GlobalShortcutsBackend(GlobalShortcutsManager *manager, const Type type, QObject *parent = nullptr);

View File

@@ -107,28 +107,28 @@ void GlobalShortcutsManager::ReloadSettings() {
backends_enabled_.clear();
#ifdef Q_OS_MACOS
backends_enabled_ << GlobalShortcutsBackend::Type_MacOS;
backends_enabled_ << GlobalShortcutsBackend::Type::macOS;
#endif
#ifdef Q_OS_WIN
backends_enabled_ << GlobalShortcutsBackend::Type_Win;
backends_enabled_ << GlobalShortcutsBackend::Type::Win;
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
if (settings_.value("use_kde", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_KDE;
backends_enabled_ << GlobalShortcutsBackend::Type::KDE;
}
if (settings_.value("use_gnome", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_Gnome;
backends_enabled_ << GlobalShortcutsBackend::Type::Gnome;
}
if (settings_.value("use_mate", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_Mate;
backends_enabled_ << GlobalShortcutsBackend::Type::Mate;
}
#endif
#ifdef HAVE_X11_GLOBALSHORTCUTS
if (settings_.value("use_x11", false).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_X11;
backends_enabled_ << GlobalShortcutsBackend::Type::X11;
}
#endif