Rename KDE global shortcuts to KGlobalAccel
This commit is contained in:
@@ -312,7 +312,7 @@ optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
|
|||||||
DEPENDS "QX11Application" HAVE_QX11APPLICATION
|
DEPENDS "QX11Application" HAVE_QX11APPLICATION
|
||||||
)
|
)
|
||||||
|
|
||||||
optional_component(KDE_GLOBALSHORTCUTS ON "KDE global shortcuts"
|
optional_component(KGLOBALACCEL_GLOBALSHORTCUTS ON "KGlobalAccel global shortcuts"
|
||||||
DEPENDS "D-Bus support" HAVE_DBUS
|
DEPENDS "D-Bus support" HAVE_DBUS
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ if(HAVE_SONGFINGERPRINTING OR HAVE_MUSICBRAINZ)
|
|||||||
set(HAVE_CHROMAPRINT ON)
|
set(HAVE_CHROMAPRINT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_X11_GLOBALSHORTCUTS OR HAVE_KDE_GLOBALSHORTCUTS OR APPLE OR WIN32)
|
if(HAVE_X11_GLOBALSHORTCUTS OR HAVE_KGLOBALACCEL_GLOBALSHORTCUTS OR APPLE OR WIN32)
|
||||||
set(HAVE_GLOBALSHORTCUTS ON)
|
set(HAVE_GLOBALSHORTCUTS ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -1226,10 +1226,10 @@ if(HAVE_GLOBALSHORTCUTS)
|
|||||||
UI src/globalshortcuts/globalshortcutgrabber.ui src/settings/globalshortcutssettingspage.ui
|
UI src/globalshortcuts/globalshortcutgrabber.ui src/settings/globalshortcutssettingspage.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(HAVE_KDE_GLOBALSHORTCUTS)
|
if(HAVE_KGLOBALACCEL_GLOBALSHORTCUTS)
|
||||||
optional_source(HAVE_KDE_GLOBALSHORTCUTS
|
optional_source(HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
SOURCES src/globalshortcuts/globalshortcutsbackend-kde.cpp
|
SOURCES src/globalshortcuts/globalshortcutsbackend-kglobalaccel.cpp
|
||||||
HEADERS src/globalshortcuts/globalshortcutsbackend-kde.h
|
HEADERS src/globalshortcuts/globalshortcutsbackend-kglobalaccel.h
|
||||||
)
|
)
|
||||||
qt_add_dbus_interface(SOURCES src/globalshortcuts/org.kde.KGlobalAccel.xml kglobalaccel)
|
qt_add_dbus_interface(SOURCES src/globalshortcuts/org.kde.KGlobalAccel.xml kglobalaccel)
|
||||||
qt_add_dbus_interface(SOURCES src/globalshortcuts/org.kde.KGlobalAccel.Component.xml kglobalaccelcomponent)
|
qt_add_dbus_interface(SOURCES src/globalshortcuts/org.kde.KGlobalAccel.Component.xml kglobalaccelcomponent)
|
||||||
|
|||||||
6
debian/copyright
vendored
6
debian/copyright
vendored
@@ -75,10 +75,8 @@ Files: src/core/main.h
|
|||||||
src/covermanager/spotifycoverprovider.h
|
src/covermanager/spotifycoverprovider.h
|
||||||
src/covermanager/musixmatchcoverprovider.cpp
|
src/covermanager/musixmatchcoverprovider.cpp
|
||||||
src/covermanager/musixmatchcoverprovider.h
|
src/covermanager/musixmatchcoverprovider.h
|
||||||
src/globalshortcuts/globalshortcutsbackend-kde.cpp
|
src/globalshortcuts/globalshortcutsbackend-kglobalaccel.cpp
|
||||||
src/globalshortcuts/globalshortcutsbackend-kde.h
|
src/globalshortcuts/globalshortcutsbackend-kglobalaccel.h
|
||||||
src/globalshortcuts/globalshortcutsbackend-mate.cpp
|
|
||||||
src/globalshortcuts/globalshortcutsbackend-mate.h
|
|
||||||
src/globalshortcuts/globalshortcutsbackend-x11.cpp
|
src/globalshortcuts/globalshortcutsbackend-x11.cpp
|
||||||
src/globalshortcuts/globalshortcutsbackend-x11.h
|
src/globalshortcuts/globalshortcutsbackend-x11.h
|
||||||
src/globalshortcuts/globalshortcutsbackend-win.cpp
|
src/globalshortcuts/globalshortcutsbackend-win.cpp
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#cmakedefine HAVE_EBUR128
|
#cmakedefine HAVE_EBUR128
|
||||||
#cmakedefine HAVE_GLOBALSHORTCUTS
|
#cmakedefine HAVE_GLOBALSHORTCUTS
|
||||||
#cmakedefine HAVE_X11_GLOBALSHORTCUTS
|
#cmakedefine HAVE_X11_GLOBALSHORTCUTS
|
||||||
#cmakedefine HAVE_KDE_GLOBALSHORTCUTS
|
#cmakedefine HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
#cmakedefine HAVE_SUBSONIC
|
#cmakedefine HAVE_SUBSONIC
|
||||||
#cmakedefine HAVE_TIDAL
|
#cmakedefine HAVE_TIDAL
|
||||||
#cmakedefine HAVE_SPOTIFY
|
#cmakedefine HAVE_SPOTIFY
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
namespace GlobalShortcutsSettings {
|
namespace GlobalShortcutsSettings {
|
||||||
|
|
||||||
constexpr char kSettingsGroup[] = "GlobalShortcuts";
|
constexpr char kSettingsGroup[] = "GlobalShortcuts";
|
||||||
constexpr char kUseKDE[] = "use_kde";
|
constexpr char kUseKGlobalAccel[] = "use_kglobalaccel";
|
||||||
constexpr char kUseX11[] = "use_x11";
|
constexpr char kUseX11[] = "use_x11";
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
#include "globalshortcutsbackend-kde.h"
|
#include "globalshortcutsbackend-kglobalaccel.h"
|
||||||
|
|
||||||
#include "kglobalaccel.h"
|
#include "kglobalaccel.h"
|
||||||
#include "kglobalaccelcomponent.h"
|
#include "kglobalaccelcomponent.h"
|
||||||
@@ -41,28 +41,28 @@
|
|||||||
using namespace Qt::Literals::StringLiterals;
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr char kKdeService[] = "org.kde.kglobalaccel";
|
constexpr char kKGlobalAccelService[] = "org.kde.kglobalaccel";
|
||||||
constexpr char kKdePath[] = "/kglobalaccel";
|
constexpr char kKGlobalAccelPath[] = "/kglobalaccel";
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalShortcutsBackendKDE::GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent)
|
GlobalShortcutsBackendKGlobalAccel::GlobalShortcutsBackendKGlobalAccel(GlobalShortcutsManager *manager, QObject *parent)
|
||||||
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::KDE, parent),
|
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type::KGlobalAccel, parent),
|
||||||
interface_(nullptr),
|
interface_(nullptr),
|
||||||
component_(nullptr) {}
|
component_(nullptr) {}
|
||||||
|
|
||||||
bool GlobalShortcutsBackendKDE::IsKDEAvailable() {
|
bool GlobalShortcutsBackendKGlobalAccel::IsKGlobalAccelAvailable() {
|
||||||
|
|
||||||
return QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kKdeService));
|
return QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kKGlobalAccelService));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlobalShortcutsBackendKDE::IsAvailable() const {
|
bool GlobalShortcutsBackendKGlobalAccel::IsAvailable() const {
|
||||||
|
|
||||||
return IsKDEAvailable();
|
return IsKGlobalAccelAvailable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlobalShortcutsBackendKDE::IsMediaShortcut(const GlobalShortcutsManager::Shortcut &shortcut) const {
|
bool GlobalShortcutsBackendKGlobalAccel::IsMediaShortcut(const GlobalShortcutsManager::Shortcut &shortcut) const {
|
||||||
|
|
||||||
return (shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaPlay) ||
|
return (shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaPlay) ||
|
||||||
shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaStop) ||
|
shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaStop) ||
|
||||||
@@ -72,17 +72,17 @@ bool GlobalShortcutsBackendKDE::IsMediaShortcut(const GlobalShortcutsManager::Sh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GlobalShortcutsBackendKDE::DoRegister() {
|
bool GlobalShortcutsBackendKGlobalAccel::DoRegister() {
|
||||||
|
|
||||||
qLog(Debug) << "Registering";
|
qLog(Debug) << "Registering";
|
||||||
|
|
||||||
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kKdeService))) {
|
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String(kKGlobalAccelService))) {
|
||||||
qLog(Warning) << "KGlobalAccel is not registered";
|
qLog(Warning) << "KGlobalAccel is not registered";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!interface_) {
|
if (!interface_) {
|
||||||
interface_ = new OrgKdeKGlobalAccelInterface(QLatin1String(kKdeService), QLatin1String(kKdePath), QDBusConnection::sessionBus(), this);
|
interface_ = new OrgKdeKGlobalAccelInterface(QLatin1String(kKGlobalAccelService), QLatin1String(kKGlobalAccelPath), QDBusConnection::sessionBus(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts().values();
|
const QList<GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts().values();
|
||||||
@@ -92,13 +92,13 @@ bool GlobalShortcutsBackendKDE::DoRegister() {
|
|||||||
|
|
||||||
QDBusPendingReply<QDBusObjectPath> reply = interface_->getComponent(QCoreApplication::applicationName());
|
QDBusPendingReply<QDBusObjectPath> reply = interface_->getComponent(QCoreApplication::applicationName());
|
||||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||||
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &GlobalShortcutsBackendKDE::RegisterFinished);
|
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &GlobalShortcutsBackendKGlobalAccel::RegisterFinished);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcutsBackendKDE::RegisterFinished(QDBusPendingCallWatcher *watcher) {
|
void GlobalShortcutsBackendKGlobalAccel::RegisterFinished(QDBusPendingCallWatcher *watcher) {
|
||||||
|
|
||||||
QDBusReply<QDBusObjectPath> reply = watcher->reply();
|
QDBusReply<QDBusObjectPath> reply = watcher->reply();
|
||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
@@ -111,7 +111,7 @@ void GlobalShortcutsBackendKDE::RegisterFinished(QDBusPendingCallWatcher *watche
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!component_) {
|
if (!component_) {
|
||||||
component_ = new org::kde::kglobalaccel::Component(QLatin1String(kKdeService), reply.value().path(), QDBusConnection::sessionBus(), interface_);
|
component_ = new org::kde::kglobalaccel::Component(QLatin1String(kKGlobalAccelService), reply.value().path(), QDBusConnection::sessionBus(), interface_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!component_->isValid()) {
|
if (!component_->isValid()) {
|
||||||
@@ -119,13 +119,13 @@ void GlobalShortcutsBackendKDE::RegisterFinished(QDBusPendingCallWatcher *watche
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject::connect(component_, &org::kde::kglobalaccel::Component::globalShortcutPressed, this, &GlobalShortcutsBackendKDE::GlobalShortcutPressed, Qt::UniqueConnection);
|
QObject::connect(component_, &org::kde::kglobalaccel::Component::globalShortcutPressed, this, &GlobalShortcutsBackendKGlobalAccel::GlobalShortcutPressed, Qt::UniqueConnection);
|
||||||
|
|
||||||
qLog(Debug) << "Registered.";
|
qLog(Debug) << "Registered.";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcutsBackendKDE::DoUnregister() {
|
void GlobalShortcutsBackendKGlobalAccel::DoUnregister() {
|
||||||
|
|
||||||
if (!interface_ || !interface_->isValid()) return;
|
if (!interface_ || !interface_->isValid()) return;
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ void GlobalShortcutsBackendKDE::DoUnregister() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlobalShortcutsBackendKDE::RegisterShortcut(const GlobalShortcutsManager::Shortcut &shortcut) {
|
bool GlobalShortcutsBackendKGlobalAccel::RegisterShortcut(const GlobalShortcutsManager::Shortcut &shortcut) {
|
||||||
|
|
||||||
if (!interface_ || !interface_->isValid() || shortcut.id.isEmpty() || !shortcut.action || shortcut.action->shortcut().isEmpty()) return false;
|
if (!interface_ || !interface_->isValid() || shortcut.id.isEmpty() || !shortcut.action || shortcut.action->shortcut().isEmpty()) return false;
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ bool GlobalShortcutsBackendKDE::RegisterShortcut(const GlobalShortcutsManager::S
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList GlobalShortcutsBackendKDE::GetActionId(const QString &id, const QAction *action) {
|
QStringList GlobalShortcutsBackendKGlobalAccel::GetActionId(const QString &id, const QAction *action) {
|
||||||
|
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
ret << QCoreApplication::applicationName();
|
ret << QCoreApplication::applicationName();
|
||||||
@@ -185,7 +185,7 @@ QStringList GlobalShortcutsBackendKDE::GetActionId(const QString &id, const QAct
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> GlobalShortcutsBackendKDE::ToIntList(const QList<QKeySequence> &sequence_list) {
|
QList<int> GlobalShortcutsBackendKGlobalAccel::ToIntList(const QList<QKeySequence> &sequence_list) {
|
||||||
|
|
||||||
QList<int> ret;
|
QList<int> ret;
|
||||||
ret.reserve(sequence_list.count());
|
ret.reserve(sequence_list.count());
|
||||||
@@ -197,7 +197,7 @@ QList<int> GlobalShortcutsBackendKDE::ToIntList(const QList<QKeySequence> &seque
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QKeySequence> GlobalShortcutsBackendKDE::ToKeySequenceList(const QList<int> &sequence_list) {
|
QList<QKeySequence> GlobalShortcutsBackendKGlobalAccel::ToKeySequenceList(const QList<int> &sequence_list) {
|
||||||
|
|
||||||
QList<QKeySequence> ret;
|
QList<QKeySequence> ret;
|
||||||
ret.reserve(sequence_list.count());
|
ret.reserve(sequence_list.count());
|
||||||
@@ -209,7 +209,7 @@ QList<QKeySequence> GlobalShortcutsBackendKDE::ToKeySequenceList(const QList<int
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcutsBackendKDE::GlobalShortcutPressed(const QString &component_unique, const QString &shortcut_unique, const qint64 timestamp) {
|
void GlobalShortcutsBackendKGlobalAccel::GlobalShortcutPressed(const QString &component_unique, const QString &shortcut_unique, const qint64 timestamp) {
|
||||||
|
|
||||||
Q_UNUSED(timestamp)
|
Q_UNUSED(timestamp)
|
||||||
|
|
||||||
@@ -37,14 +37,14 @@ class QAction;
|
|||||||
class OrgKdeKGlobalAccelInterface;
|
class OrgKdeKGlobalAccelInterface;
|
||||||
class OrgKdeKglobalaccelComponentInterface;
|
class OrgKdeKglobalaccelComponentInterface;
|
||||||
|
|
||||||
class GlobalShortcutsBackendKDE : public GlobalShortcutsBackend {
|
class GlobalShortcutsBackendKGlobalAccel : public GlobalShortcutsBackend {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent = nullptr);
|
explicit GlobalShortcutsBackendKGlobalAccel(GlobalShortcutsManager *manager, QObject *parent = nullptr);
|
||||||
|
|
||||||
bool IsAvailable() const override;
|
bool IsAvailable() const override;
|
||||||
static bool IsKDEAvailable();
|
static bool IsKGlobalAccelAvailable();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool DoRegister() override;
|
bool DoRegister() override;
|
||||||
@@ -38,8 +38,8 @@ QString GlobalShortcutsBackend::name() const {
|
|||||||
switch (type_) {
|
switch (type_) {
|
||||||
case Type::None:
|
case Type::None:
|
||||||
return u"None"_s;
|
return u"None"_s;
|
||||||
case Type::KDE:
|
case Type::KGlobalAccel:
|
||||||
return u"KDE"_s;
|
return u"KGlobalAccel"_s;
|
||||||
case Type::X11:
|
case Type::X11:
|
||||||
return u"X11"_s;
|
return u"X11"_s;
|
||||||
case Type::macOS:
|
case Type::macOS:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class GlobalShortcutsBackend : public QObject {
|
|||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
None = 0,
|
None = 0,
|
||||||
KDE,
|
KGlobalAccel,
|
||||||
X11,
|
X11,
|
||||||
macOS,
|
macOS,
|
||||||
Win
|
Win
|
||||||
|
|||||||
@@ -36,8 +36,8 @@
|
|||||||
#include "globalshortcutsmanager.h"
|
#include "globalshortcutsmanager.h"
|
||||||
#include "globalshortcutsbackend.h"
|
#include "globalshortcutsbackend.h"
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
#include "globalshortcutsbackend-kde.h"
|
#include "globalshortcutsbackend-kglobalaccel.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||||
@@ -84,8 +84,8 @@ GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent) : QWidget(parent
|
|||||||
|
|
||||||
// Create backends - these do the actual shortcut registration
|
// Create backends - these do the actual shortcut registration
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
backends_ << new GlobalShortcutsBackendKDE(this, this);
|
backends_ << new GlobalShortcutsBackendKGlobalAccel(this, this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
@@ -116,9 +116,9 @@ void GlobalShortcutsManager::ReloadSettings() {
|
|||||||
backends_enabled_ << GlobalShortcutsBackend::Type::Win;
|
backends_enabled_ << GlobalShortcutsBackend::Type::Win;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
if (settings_.value(GlobalShortcutsSettings::kUseKDE, true).toBool()) {
|
if (settings_.value(GlobalShortcutsSettings::kUseKGlobalAccel, true).toBool()) {
|
||||||
backends_enabled_ << GlobalShortcutsBackend::Type::KDE;
|
backends_enabled_ << GlobalShortcutsBackend::Type::KGlobalAccel;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -159,11 +159,11 @@ GlobalShortcutsManager::Shortcut GlobalShortcutsManager::AddShortcut(const QStri
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
|
|
||||||
bool GlobalShortcutsManager::IsKdeAvailable() {
|
bool GlobalShortcutsManager::IsKGlobalAccelAvailable() {
|
||||||
|
|
||||||
return GlobalShortcutsBackendKDE::IsKDEAvailable();
|
return GlobalShortcutsBackendKGlobalAccel::IsKGlobalAccelAvailable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class GlobalShortcutsManager : public QWidget {
|
|||||||
QMap<QString, Shortcut> shortcuts() const { return shortcuts_; }
|
QMap<QString, Shortcut> shortcuts() const { return shortcuts_; }
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
|
||||||
static bool IsKdeAvailable();
|
static bool IsKGlobalAccelAvailable();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "utilities/envutils.h"
|
|
||||||
#include "constants/globalshortcutssettings.h"
|
#include "constants/globalshortcutssettings.h"
|
||||||
#include "globalshortcuts/globalshortcutgrabber.h"
|
#include "globalshortcuts/globalshortcutgrabber.h"
|
||||||
#include "globalshortcuts/globalshortcutsmanager.h"
|
#include "globalshortcuts/globalshortcutsmanager.h"
|
||||||
@@ -72,10 +71,10 @@ GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog,
|
|||||||
QObject::connect(ui_->radio_custom, &QRadioButton::clicked, this, &GlobalShortcutsSettingsPage::ChangeClicked);
|
QObject::connect(ui_->radio_custom, &QRadioButton::clicked, this, &GlobalShortcutsSettingsPage::ChangeClicked);
|
||||||
QObject::connect(ui_->button_change, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::ChangeClicked);
|
QObject::connect(ui_->button_change, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::ChangeClicked);
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
QObject::connect(ui_->checkbox_kde, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
QObject::connect(ui_->checkbox_kglobalaccel, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
|
||||||
#else
|
#else
|
||||||
ui_->widget_kde->hide();
|
ui_->widget_kglobalaccel->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||||
@@ -100,21 +99,20 @@ void GlobalShortcutsSettingsPage::Load() {
|
|||||||
if (!initialized_) {
|
if (!initialized_) {
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
|
|
||||||
de_ = Utilities::DesktopEnvironment();
|
|
||||||
ui_->widget_warning->hide();
|
ui_->widget_warning->hide();
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
QObject::connect(ui_->button_macos_preferences, &QPushButton::clicked, global_shortcuts_manager_, &GlobalShortcutsManager::ShowMacAccessibilityDialog);
|
QObject::connect(ui_->button_macos_preferences, &QPushButton::clicked, global_shortcuts_manager_, &GlobalShortcutsManager::ShowMacAccessibilityDialog);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
if (GlobalShortcutsManager::IsKdeAvailable()) {
|
if (GlobalShortcutsManager::IsKGlobalAccelAvailable()) {
|
||||||
qLog(Debug) << "KDE (KGlobalAccel) backend is available.";
|
qLog(Debug) << "KGlobalAccel backend is available.";
|
||||||
ui_->widget_kde->show();
|
ui_->widget_kglobalaccel->show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qLog(Debug) << "KDE (KGlobalAccel) backend is unavailable.";
|
qLog(Debug) << "KGlobalAccel backend is unavailable.";
|
||||||
ui_->widget_kde->hide();
|
ui_->widget_kglobalaccel->hide();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -148,9 +146,9 @@ void GlobalShortcutsSettingsPage::Load() {
|
|||||||
SetShortcut(shortcut.s.id, shortcut.s.action->shortcut());
|
SetShortcut(shortcut.s.id, shortcut.s.action->shortcut());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
if (ui_->widget_kde->isVisibleTo(this)) {
|
if (ui_->widget_kglobalaccel->isVisibleTo(this)) {
|
||||||
ui_->checkbox_kde->setChecked(s.value(kUseKDE, true).toBool());
|
ui_->checkbox_kglobalaccel->setChecked(s.value(kUseKGlobalAccel, true).toBool());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -160,7 +158,7 @@ void GlobalShortcutsSettingsPage::Load() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_KDE_GLOBALSHORTCUTS) || defined(HAVE_X11_GLOBALSHORTCUTS)
|
#if defined(HAVE_KGLOBALACCEL_GLOBALSHORTCUTS) || defined(HAVE_X11_GLOBALSHORTCUTS)
|
||||||
ShortcutOptionsChanged();
|
ShortcutOptionsChanged();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -188,8 +186,8 @@ void GlobalShortcutsSettingsPage::Save() {
|
|||||||
s.setValue(shortcut.s.id, shortcut.key.toString());
|
s.setValue(shortcut.s.id, shortcut.key.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_KDE_GLOBALSHORTCUTS
|
#ifdef HAVE_KGLOBALACCEL_GLOBALSHORTCUTS
|
||||||
s.setValue(kUseKDE, ui_->checkbox_kde->isChecked());
|
s.setValue(kUseKGlobalAccel, ui_->checkbox_kglobalaccel->isChecked());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
#ifdef HAVE_X11_GLOBALSHORTCUTS
|
||||||
@@ -204,7 +202,7 @@ void GlobalShortcutsSettingsPage::Save() {
|
|||||||
|
|
||||||
void GlobalShortcutsSettingsPage::ShortcutOptionsChanged() {
|
void GlobalShortcutsSettingsPage::ShortcutOptionsChanged() {
|
||||||
|
|
||||||
bool configure_shortcuts = (ui_->widget_kde->isVisibleTo(this) && ui_->checkbox_kde->isChecked()) ||
|
bool configure_shortcuts = (ui_->widget_kglobalaccel->isVisibleTo(this) && ui_->checkbox_kglobalaccel->isChecked()) ||
|
||||||
(ui_->widget_x11->isVisibleTo(this) && ui_->checkbox_x11->isChecked());
|
(ui_->widget_x11->isVisibleTo(this) && ui_->checkbox_x11->isChecked());
|
||||||
|
|
||||||
ui_->list->setEnabled(configure_shortcuts);
|
ui_->list->setEnabled(configure_shortcuts);
|
||||||
@@ -289,15 +287,7 @@ void GlobalShortcutsSettingsPage::ChangeClicked() {
|
|||||||
|
|
||||||
void GlobalShortcutsSettingsPage::X11Warning() {
|
void GlobalShortcutsSettingsPage::X11Warning() {
|
||||||
|
|
||||||
QString de = de_.toLower();
|
ui_->label_warn_text->setText(tr("Using X11 shortcuts is not recommended and can cause keyboard to become unresponsive! Shortcuts on should usually be used through MPRIS2 / KGlobalAccel."));
|
||||||
if (de == "kde"_L1 || de == "gnome"_L1 || de == "x-cinnamon"_L1 || de == "mate"_L1) {
|
ui_->widget_warning->show();
|
||||||
QString text(tr("Using X11 shortcuts on %1 is not recommended and can cause keyboard to become unresponsive!").arg(de_));
|
|
||||||
text += tr(" Shortcuts on %1 are usually used through MPRIS and KGlobalAccel.").arg(de_);
|
|
||||||
ui_->label_warn_text->setText(text);
|
|
||||||
ui_->widget_warning->show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui_->widget_warning->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ class GlobalShortcutsSettingsPage : public SettingsPage {
|
|||||||
QMap<QString, Shortcut> shortcuts_;
|
QMap<QString, Shortcut> shortcuts_;
|
||||||
|
|
||||||
QString current_id_;
|
QString current_id_;
|
||||||
QString de_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLOBALSHORTCUTSSETTINGSPAGE_H
|
#endif // GLOBALSHORTCUTSSETTINGSPAGE_H
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="layout_globalshortcutssettingspage">
|
<layout class="QVBoxLayout" name="layout_globalshortcutssettingspage">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_kde" native="true">
|
<widget class="QWidget" name="widget_kglobalaccel" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkbox_kde">
|
<widget class="QCheckBox" name="checkbox_kglobalaccel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use KDE (KGlobalAccel) shortcuts when available</string>
|
<string>Use KGlobalAccel shortcuts when available</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user