Various cleanup to global shortcuts code

This commit is contained in:
Jonas Kvinge
2021-09-01 21:37:11 +02:00
parent 49d9ded684
commit 20a23c2868
20 changed files with 447 additions and 198 deletions

View File

@@ -580,16 +580,14 @@ if(HAVE_GLOBALSHORTCUTS)
SOURCES globalshortcuts/globalshortcutsbackend-kde.cpp globalshortcuts/globalshortcutsbackend-gnome.cpp globalshortcuts/globalshortcutsbackend-mate.cpp SOURCES globalshortcuts/globalshortcutsbackend-kde.cpp globalshortcuts/globalshortcutsbackend-gnome.cpp globalshortcuts/globalshortcutsbackend-mate.cpp
HEADERS globalshortcuts/globalshortcutsbackend-kde.h globalshortcuts/globalshortcutsbackend-gnome.h globalshortcuts/globalshortcutsbackend-mate.h HEADERS globalshortcuts/globalshortcutsbackend-kde.h globalshortcuts/globalshortcutsbackend-gnome.h globalshortcuts/globalshortcutsbackend-mate.h
) )
# Native shortcuts for X11 and Windows optional_source(HAVE_X11_GLOBALSHORTCUTS
if(HAVE_X11_GLOBALSHORTCUTS OR WIN32) SOURCES globalshortcuts/globalshortcutsbackend-x11.cpp globalshortcuts/globalshortcut.cpp globalshortcuts/globalshortcut-x11.cpp
SET(X11_OR_WIN ON) HEADERS globalshortcuts/globalshortcutsbackend-x11.h globalshortcuts/globalshortcut.h
optional_source(X11_OR_WIN )
SOURCES globalshortcuts/globalshortcutsbackend-system.cpp globalshortcuts/globalshortcut.cpp optional_source(WIN32
HEADERS globalshortcuts/globalshortcutsbackend-system.h globalshortcuts/globalshortcut.h SOURCES globalshortcuts/globalshortcutsbackend-win.cpp globalshortcuts/globalshortcut.cpp globalshortcuts/globalshortcut-win.cpp
) HEADERS globalshortcuts/globalshortcutsbackend-win.h globalshortcuts/globalshortcut.h
optional_source(HAVE_X11_GLOBALSHORTCUTS SOURCES globalshortcuts/globalshortcut-x11.cpp) )
optional_source(WIN32 SOURCES globalshortcuts/globalshortcut-win.cpp)
endif()
endif(HAVE_GLOBALSHORTCUTS) endif(HAVE_GLOBALSHORTCUTS)
# ALSA # ALSA

View File

@@ -43,11 +43,15 @@ const char *GlobalShortcutsBackendGnome::kService2 = "org.gnome.SettingsDaemon";
const char *GlobalShortcutsBackendGnome::kPath = "/org/gnome/SettingsDaemon/MediaKeys"; const char *GlobalShortcutsBackendGnome::kPath = "/org/gnome/SettingsDaemon/MediaKeys";
GlobalShortcutsBackendGnome::GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent) GlobalShortcutsBackendGnome::GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent), : GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_Gnome, parent),
interface_(nullptr), interface_(nullptr),
is_connected_(false) {} is_connected_(false) {}
bool GlobalShortcutsBackendGnome::IsAvailable() { bool GlobalShortcutsBackendGnome::IsAvailable() const {
return IsGnomeAvailable();
}
bool GlobalShortcutsBackendGnome::IsGnomeAvailable() {
return QDBusConnection::sessionBus().interface()->isServiceRegistered(kService1) || QDBusConnection::sessionBus().interface()->isServiceRegistered(kService2); return QDBusConnection::sessionBus().interface()->isServiceRegistered(kService1) || QDBusConnection::sessionBus().interface()->isServiceRegistered(kService2);

View File

@@ -39,7 +39,8 @@ class GlobalShortcutsBackendGnome : public GlobalShortcutsBackend {
public: public:
explicit GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent = nullptr); explicit GlobalShortcutsBackendGnome(GlobalShortcutsManager *manager, QObject *parent = nullptr);
bool IsAvailable() override; bool IsAvailable() const override;
static bool IsGnomeAvailable();
protected: protected:
bool DoRegister() override; bool DoRegister() override;

View File

@@ -42,16 +42,22 @@ const char *GlobalShortcutsBackendKDE::kKdeService = "org.kde.kglobalaccel";
const char *GlobalShortcutsBackendKDE::kKdePath = "/kglobalaccel"; const char *GlobalShortcutsBackendKDE::kKdePath = "/kglobalaccel";
GlobalShortcutsBackendKDE::GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent) GlobalShortcutsBackendKDE::GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent), : GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_KDE, parent),
interface_(nullptr), interface_(nullptr),
component_(nullptr) {} component_(nullptr) {}
bool GlobalShortcutsBackendKDE::IsAvailable() { bool GlobalShortcutsBackendKDE::IsKDEAvailable() {
return QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService); return QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService);
} }
bool GlobalShortcutsBackendKDE::IsAvailable() const {
return IsKDEAvailable();
}
bool GlobalShortcutsBackendKDE::DoRegister() { bool GlobalShortcutsBackendKDE::DoRegister() {
qLog(Debug) << "Registering"; qLog(Debug) << "Registering";

View File

@@ -43,7 +43,8 @@ class GlobalShortcutsBackendKDE : public GlobalShortcutsBackend {
public: public:
explicit GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent = nullptr); explicit GlobalShortcutsBackendKDE(GlobalShortcutsManager *manager, QObject *parent = nullptr);
bool IsAvailable() override; bool IsAvailable() const override;
static bool IsKDEAvailable();
protected: protected:
bool DoRegister() override; bool DoRegister() override;

View File

@@ -2,6 +2,7 @@
* Strawberry Music Player * Strawberry Music Player
* This file was part of Clementine. * This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com> * Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
* *
* Strawberry is free software: you can redistribute it and/or modify * Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -32,8 +33,6 @@
#include <QAction> #include <QAction>
#include <QKeySequence> #include <QKeySequence>
class GlobalShortcut;
class GlobalShortcutsBackendMacOSPrivate; class GlobalShortcutsBackendMacOSPrivate;
class GlobalShortcutsBackendMacOS : public GlobalShortcutsBackend { class GlobalShortcutsBackendMacOS : public GlobalShortcutsBackend {
@@ -43,12 +42,12 @@ class GlobalShortcutsBackendMacOS : public GlobalShortcutsBackend {
explicit GlobalShortcutsBackendMacOS(GlobalShortcutsManager *manager, QObject *parent = nullptr); explicit GlobalShortcutsBackendMacOS(GlobalShortcutsManager *manager, QObject *parent = nullptr);
virtual ~GlobalShortcutsBackendMacOS(); virtual ~GlobalShortcutsBackendMacOS();
bool IsAvailable() override { return true; } bool IsAvailable() const override { return true; }
bool IsAccessibilityEnabled() const; static bool IsAccessibilityEnabled();
void ShowAccessibilityDialog(); static void ShowAccessibilityDialog();
void MacMediaKeyPressed(int key); void MacMediaKeyPressed(const int key);
protected: protected:
bool DoRegister() override; bool DoRegister() override;

View File

@@ -2,6 +2,7 @@
* Strawberry Music Player * Strawberry Music Player
* This file was part of Clementine. * This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com> * Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
* *
* Strawberry is free software: you can redistribute it and/or modify * Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -78,7 +79,7 @@ class GlobalShortcutsBackendMacOSPrivate : boost::noncopyable {
}; };
GlobalShortcutsBackendMacOS::GlobalShortcutsBackendMacOS(GlobalShortcutsManager *manager, QObject *parent) GlobalShortcutsBackendMacOS::GlobalShortcutsBackendMacOS(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent), : GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_MacOS, parent),
p_(new GlobalShortcutsBackendMacOSPrivate(this)) {} p_(new GlobalShortcutsBackendMacOSPrivate(this)) {}
GlobalShortcutsBackendMacOS::~GlobalShortcutsBackendMacOS() {} GlobalShortcutsBackendMacOS::~GlobalShortcutsBackendMacOS() {}
@@ -104,7 +105,7 @@ void GlobalShortcutsBackendMacOS::DoUnregister() {
} }
void GlobalShortcutsBackendMacOS::MacMediaKeyPressed(int key) { void GlobalShortcutsBackendMacOS::MacMediaKeyPressed(const int key) {
switch (key) { switch (key) {
case NX_KEYTYPE_PLAY: case NX_KEYTYPE_PLAY:
@@ -134,7 +135,7 @@ bool GlobalShortcutsBackendMacOS::KeyPressed(const QKeySequence &sequence) {
} }
bool GlobalShortcutsBackendMacOS::IsAccessibilityEnabled() const { bool GlobalShortcutsBackendMacOS::IsAccessibilityEnabled() {
NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES}; NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
return AXIsProcessTrustedWithOptions((CFDictionaryRef)options); return AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
@@ -165,4 +166,5 @@ void GlobalShortcutsBackendMacOS::ShowAccessibilityDialog() {
} }
} }
} }
} }

View File

@@ -41,11 +41,17 @@ const char *GlobalShortcutsBackendMate::kService2 = "org.mate.SettingsDaemon";
const char *GlobalShortcutsBackendMate::kPath = "/org/mate/SettingsDaemon/MediaKeys"; const char *GlobalShortcutsBackendMate::kPath = "/org/mate/SettingsDaemon/MediaKeys";
GlobalShortcutsBackendMate::GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent) GlobalShortcutsBackendMate::GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent), : GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_Mate, parent),
interface_(nullptr), interface_(nullptr),
is_connected_(false) {} is_connected_(false) {}
bool GlobalShortcutsBackendMate::IsAvailable() { bool GlobalShortcutsBackendMate::IsAvailable() const {
return IsMateAvailable();
}
bool GlobalShortcutsBackendMate::IsMateAvailable() {
return QDBusConnection::sessionBus().interface()->isServiceRegistered(kService1) || QDBusConnection::sessionBus().interface()->isServiceRegistered(kService2); return QDBusConnection::sessionBus().interface()->isServiceRegistered(kService1) || QDBusConnection::sessionBus().interface()->isServiceRegistered(kService2);

View File

@@ -37,7 +37,8 @@ class GlobalShortcutsBackendMate : public GlobalShortcutsBackend {
public: public:
explicit GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent = nullptr); explicit GlobalShortcutsBackendMate(GlobalShortcutsManager *manager, QObject *parent = nullptr);
bool IsAvailable() override; bool IsAvailable() const override;
static bool IsMateAvailable();
protected: protected:
bool DoRegister() override; bool DoRegister() override;

View File

@@ -19,7 +19,7 @@
#include "config.h" #include "config.h"
#include "globalshortcutsbackend-system.h" #include "globalshortcutsbackend-win.h"
#include "core/logging.h" #include "core/logging.h"
@@ -33,13 +33,19 @@
#include "globalshortcutsbackend.h" #include "globalshortcutsbackend.h"
#include "globalshortcut.h" #include "globalshortcut.h"
GlobalShortcutsBackendSystem::GlobalShortcutsBackendSystem(GlobalShortcutsManager *manager, QObject *parent) GlobalShortcutsBackendWin::GlobalShortcutsBackendWin(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, parent), : GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_Win, parent),
gshortcut_init_(nullptr) {} gshortcut_init_(nullptr) {}
GlobalShortcutsBackendSystem::~GlobalShortcutsBackendSystem() { GlobalShortcutsBackendSystem::DoUnregister(); } GlobalShortcutsBackendWin::~GlobalShortcutsBackendWin() {
GlobalShortcutsBackendWin::DoUnregister();
}
bool GlobalShortcutsBackendSystem::DoRegister() { bool GlobalShortcutsBackendWin::IsAvailable() const {
return true;
}
bool GlobalShortcutsBackendWin::DoRegister() {
qLog(Debug) << "Registering"; qLog(Debug) << "Registering";
@@ -54,7 +60,7 @@ bool GlobalShortcutsBackendSystem::DoRegister() {
} }
bool GlobalShortcutsBackendSystem::AddShortcut(QAction *action) { bool GlobalShortcutsBackendWin::AddShortcut(QAction *action) {
if (action->shortcut().isEmpty()) return false; if (action->shortcut().isEmpty()) return false;
@@ -65,7 +71,7 @@ bool GlobalShortcutsBackendSystem::AddShortcut(QAction *action) {
} }
void GlobalShortcutsBackendSystem::DoUnregister() { void GlobalShortcutsBackendWin::DoUnregister() {
qLog(Debug) << "Unregistering"; qLog(Debug) << "Unregistering";

View File

@@ -17,13 +17,11 @@
* *
*/ */
#ifndef GLOBALSHORTCUTSBACKEND_SYSTEM_H #ifndef GLOBALSHORTCUTSBACKEND_WIN_H
#define GLOBALSHORTCUTSBACKEND_SYSTEM_H #define GLOBALSHORTCUTSBACKEND_WIN_H
#include "config.h" #include "config.h"
#include "core/logging.h"
#include <QObject> #include <QObject>
#include <QList> #include <QList>
#include <QString> #include <QString>
@@ -34,14 +32,14 @@ class QAction;
class GlobalShortcutsManager; class GlobalShortcutsManager;
class GlobalShortcut; class GlobalShortcut;
class GlobalShortcutsBackendSystem : public GlobalShortcutsBackend { class GlobalShortcutsBackendWin : public GlobalShortcutsBackend {
Q_OBJECT Q_OBJECT
public: public:
explicit GlobalShortcutsBackendSystem(GlobalShortcutsManager *manager, QObject *parent = nullptr); explicit GlobalShortcutsBackendWin(GlobalShortcutsManager *manager, QObject *parent = nullptr);
~GlobalShortcutsBackendSystem() override; ~GlobalShortcutsBackendWin() override;
bool IsAvailable() override { return true; } bool IsAvailable() const override;
protected: protected:
bool DoRegister() override; bool DoRegister() override;
@@ -56,4 +54,4 @@ class GlobalShortcutsBackendSystem : public GlobalShortcutsBackend {
}; };
#endif // GLOBALSHORTCUTSBACKEND_SYSTEM_H #endif // GLOBALSHORTCUTSBACKEND_WIN_H

View File

@@ -0,0 +1,91 @@
/*
* Strawberry Music Player
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include "globalshortcutsbackend-x11.h"
#include "core/logging.h"
#include <QObject>
#include <QApplication>
#include <QMap>
#include <QAction>
#include <QKeySequence>
#include <QtAlgorithms>
#include "globalshortcutsmanager.h"
#include "globalshortcutsbackend.h"
#include "globalshortcut.h"
GlobalShortcutsBackendX11::GlobalShortcutsBackendX11(GlobalShortcutsManager *manager, QObject *parent)
: GlobalShortcutsBackend(manager, GlobalShortcutsBackend::Type_X11, parent),
gshortcut_init_(nullptr) {}
GlobalShortcutsBackendX11::~GlobalShortcutsBackendX11() { GlobalShortcutsBackendX11::DoUnregister(); }
bool GlobalShortcutsBackendX11::IsAvailable() const {
return IsX11Available();
}
bool GlobalShortcutsBackendX11::IsX11Available() {
return QApplication::platformName() == "xcb";
}
bool GlobalShortcutsBackendX11::DoRegister() {
qLog(Debug) << "Registering";
if (!gshortcut_init_) gshortcut_init_ = new GlobalShortcut(this);
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts().values();
for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) {
AddShortcut(shortcut.action);
}
return true;
}
bool GlobalShortcutsBackendX11::AddShortcut(QAction *action) {
if (action->shortcut().isEmpty()) return false;
GlobalShortcut *shortcut = new GlobalShortcut(action->shortcut(), this, this);
QObject::connect(shortcut, &GlobalShortcut::activated, action, &QAction::trigger);
shortcuts_ << shortcut;
return true;
}
void GlobalShortcutsBackendX11::DoUnregister() {
qLog(Debug) << "Unregistering";
qDeleteAll(shortcuts_);
shortcuts_.clear();
if (gshortcut_init_) {
delete gshortcut_init_;
gshortcut_init_ = nullptr;
}
}

View File

@@ -0,0 +1,58 @@
/*
* Strawberry Music Player
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GLOBALSHORTCUTSBACKEND_X11_H
#define GLOBALSHORTCUTSBACKEND_X11_H
#include "config.h"
#include <QObject>
#include <QList>
#include <QString>
#include "globalshortcutsbackend.h"
class QAction;
class GlobalShortcutsManager;
class GlobalShortcut;
class GlobalShortcutsBackendX11 : public GlobalShortcutsBackend {
Q_OBJECT
public:
explicit GlobalShortcutsBackendX11(GlobalShortcutsManager *manager, QObject *parent = nullptr);
~GlobalShortcutsBackendX11() override;
bool IsAvailable() const override;
static bool IsX11Available();
protected:
bool DoRegister() override;
void DoUnregister() override;
private:
bool AddShortcut(QAction *action);
bool RemoveShortcut(QAction *action);
QList<GlobalShortcut*> shortcuts_;
GlobalShortcut *gshortcut_init_;
};
#endif // GLOBALSHORTCUTSBACKEND_X11_H

View File

@@ -25,18 +25,46 @@
#include "globalshortcutsbackend.h" #include "globalshortcutsbackend.h"
#include "globalshortcutsmanager.h" #include "globalshortcutsmanager.h"
GlobalShortcutsBackend::GlobalShortcutsBackend(GlobalShortcutsManager *manager, QObject *parent) GlobalShortcutsBackend::GlobalShortcutsBackend(GlobalShortcutsManager *manager, const Type type, QObject *parent)
: QObject(parent), : QObject(parent),
manager_(manager), manager_(manager),
type_(type),
active_(false) {} active_(false) {}
QString GlobalShortcutsBackend::name() const {
switch(type_) {
case Type_None:
return "None";
case Type_KDE:
return "KDE";
case Type_Gnome:
return "Gnome";
case Type_Mate:
return "Mate";
case Type_X11:
return "X11";
case Type_MacOS:
return "macOS";
case Type_Win:
return "Windows";
}
return QString();
}
bool GlobalShortcutsBackend::Register() { bool GlobalShortcutsBackend::Register() {
bool ret = DoRegister(); bool ret = DoRegister();
if (ret) active_ = true; if (ret) active_ = true;
return ret; return ret;
} }
void GlobalShortcutsBackend::Unregister() { void GlobalShortcutsBackend::Unregister() {
DoUnregister(); DoUnregister();
active_ = false; active_ = false;
} }

View File

@@ -32,14 +32,27 @@ class GlobalShortcutsBackend : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit GlobalShortcutsBackend(GlobalShortcutsManager *manager, QObject *parent = nullptr); enum Type {
Type_None = 0,
Type_KDE,
Type_Gnome,
Type_Mate,
Type_X11,
Type_MacOS,
Type_Win
};
bool is_active() const { return active_; } explicit GlobalShortcutsBackend(GlobalShortcutsManager *manager, const Type type, QObject *parent = nullptr);
bool type() const { return type_; }
QString name() const;
virtual bool IsAvailable() const = 0;
bool Register(); bool Register();
void Unregister(); void Unregister();
virtual bool IsAvailable() = 0; bool is_active() const { return active_; }
signals: signals:
void RegisterFinished(bool success); void RegisterFinished(bool success);
@@ -49,6 +62,7 @@ class GlobalShortcutsBackend : public QObject {
virtual void DoUnregister() = 0; virtual void DoUnregister() = 0;
GlobalShortcutsManager *manager_; GlobalShortcutsManager *manager_;
Type type_;
bool active_; bool active_;
}; };

View File

@@ -30,37 +30,32 @@
#include <QAction> #include <QAction>
#include <QShortcut> #include <QShortcut>
#include <QKeySequence> #include <QKeySequence>
#ifdef HAVE_DBUS #include <QSettings>
# include <QDBusConnectionInterface>
#endif
#include "globalshortcutsmanager.h" #include "globalshortcutsmanager.h"
#include "globalshortcutsbackend.h" #include "globalshortcutsbackend.h"
#ifdef HAVE_DBUS #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
# include "globalshortcutsbackend-kde.h" # include "globalshortcutsbackend-kde.h"
# include "globalshortcutsbackend-gnome.h" # include "globalshortcutsbackend-gnome.h"
# include "globalshortcutsbackend-mate.h" # include "globalshortcutsbackend-mate.h"
#endif #endif
#if defined(HAVE_X11_GLOBALSHORTCUTS) || defined(Q_OS_WIN)
# include "globalshortcutsbackend-system.h" #ifdef HAVE_X11_GLOBALSHORTCUTS
# include "globalshortcutsbackend-x11.h"
#endif #endif
#ifdef Q_OS_WIN
# include "globalshortcutsbackend-win.h"
#endif
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
# include "globalshortcutsbackend-macos.h" # include "globalshortcutsbackend-macos.h"
#endif #endif
#include "settings/globalshortcutssettingspage.h" #include "settings/globalshortcutssettingspage.h"
GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent) GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent) : QWidget(parent) {
: QWidget(parent),
kde_backend_(nullptr),
gnome_backend_(nullptr),
mate_backend_(nullptr),
system_backend_(nullptr),
use_kde_(true),
use_gnome_(true),
use_mate_(true),
use_x11_(false) {
settings_.beginGroup(GlobalShortcutsSettingsPage::kSettingsGroup); settings_.beginGroup(GlobalShortcutsSettingsPage::kSettingsGroup);
@@ -86,26 +81,23 @@ GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent)
AddShortcut("love", "Love", std::bind(&GlobalShortcutsManager::Love, this)); AddShortcut("love", "Love", std::bind(&GlobalShortcutsManager::Love, this));
// Create backends - these do the actual shortcut registration // Create backends - these do the actual shortcut registration
#ifdef HAVE_DBUS
kde_backend_ = new GlobalShortcutsBackendKDE(this, this); #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
gnome_backend_ = new GlobalShortcutsBackendGnome(this, this); backends_ << new GlobalShortcutsBackendKDE(this, this);
mate_backend_ = new GlobalShortcutsBackendMate(this, this); backends_ << new GlobalShortcutsBackendGnome(this, this);
backends_ << new GlobalShortcutsBackendMate(this, this);
#endif #endif
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
if (!system_backend_) { backends_ << new GlobalShortcutsBackendMacOS(this, this);
system_backend_ = new GlobalShortcutsBackendMacOS(this, this);
}
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (!system_backend_) { backends_ << new GlobalShortcutsBackendWin(this, this);
system_backend_ = new GlobalShortcutsBackendSystem(this, this);
}
#endif #endif
#ifdef HAVE_X11_GLOBALSHORTCUTS #ifdef HAVE_X11_GLOBALSHORTCUTS
if (!system_backend_ && IsX11Available()) { backends_ << new GlobalShortcutsBackendX11(this, this);
system_backend_ = new GlobalShortcutsBackendSystem(this, this);
}
#endif #endif
ReloadSettings(); ReloadSettings();
@@ -114,11 +106,35 @@ GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent)
void GlobalShortcutsManager::ReloadSettings() { void GlobalShortcutsManager::ReloadSettings() {
// The actual shortcuts have been set in our actions for us by the config dialog already - we just need to reread the gnome settings. backends_enabled_.clear();
use_kde_ = settings_.value("use_kde", true).toBool();
use_gnome_ = settings_.value("use_gnome", true).toBool(); #ifdef Q_OS_MACOS
use_mate_ = settings_.value("use_mate", true).toBool(); backends_enabled_ << GlobalShortcutsBackend::Type_MacOS;
use_x11_ = settings_.value("use_x11", false).toBool(); #endif
#ifdef Q_OS_WIN
backends_enabled_ << GlobalShortcutsBackend::Type_Win;
#endif
settings_.beginGroup(GlobalShortcutsSettingsPage::kSettingsGroup);
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
if (settings_.value("use_kde", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_KDE;
}
if (settings_.value("use_gnome", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_Gnome;
}
if (settings_.value("use_mate", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_Mate;
}
#endif
#ifdef HAVE_X11_GLOBALSHORTCUTS
if (settings_.value("use_x11", false).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type_X11;
}
#endif
Unregister(); Unregister();
Register(); Register();
@@ -151,80 +167,75 @@ GlobalShortcutsManager::Shortcut GlobalShortcutsManager::AddShortcut(const QStri
} }
bool GlobalShortcutsManager::IsKdeAvailable() const { #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_DBUS bool GlobalShortcutsManager::IsKdeAvailable() {
return kde_backend_->IsAvailable();
#else return GlobalShortcutsBackendKDE::IsKDEAvailable();
return false;
#endif
} }
bool GlobalShortcutsManager::IsGnomeAvailable() const { bool GlobalShortcutsManager::IsGnomeAvailable() {
#ifdef HAVE_DBUS return GlobalShortcutsBackendGnome::IsGnomeAvailable();
return gnome_backend_->IsAvailable();
#else
return false;
#endif
} }
bool GlobalShortcutsManager::IsMateAvailable() const { bool GlobalShortcutsManager::IsMateAvailable() {
#ifdef HAVE_DBUS return GlobalShortcutsBackendMate::IsMateAvailable();
return mate_backend_->IsAvailable();
#else
return false;
#endif
} }
# endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_X11_GLOBALSHORTCUTS
bool GlobalShortcutsManager::IsX11Available() { bool GlobalShortcutsManager::IsX11Available() {
return QApplication::platformName() == "xcb"; return GlobalShortcutsBackendX11::IsX11Available();
} }
void GlobalShortcutsManager::Register() { #endif // HAVE_X11_GLOBALSHORTCUTS
if (use_kde_ && kde_backend_ && kde_backend_->Register()) return; bool GlobalShortcutsManager::Register() {
if (use_gnome_ && gnome_backend_ && gnome_backend_->Register()) return;
if (use_mate_ && mate_backend_ && mate_backend_->Register()) return;
#ifdef HAVE_X11_GLOBALSHORTCUTS for (GlobalShortcutsBackend *backend : backends_) {
if (use_x11_) { if (backend && backend->IsAvailable() && !backend->is_active() && backends_enabled_.contains(backend->type())) {
#endif qLog(Info) << "Using" << backend->name() << "backend for global shortcuts.";
if (system_backend_) { return backend->Register();
system_backend_->Register();
} }
#ifdef HAVE_X11_GLOBALSHORTCUTS }
}
#endif return false;
} }
void GlobalShortcutsManager::Unregister() { void GlobalShortcutsManager::Unregister() {
if (kde_backend_ && kde_backend_->is_active()) kde_backend_->Unregister(); for (GlobalShortcutsBackend *backend : backends_) {
if (gnome_backend_ && gnome_backend_->is_active()) gnome_backend_->Unregister(); if (backend && backend->is_active()) {
if (mate_backend_ && mate_backend_->is_active()) mate_backend_->Unregister(); backend->Unregister();
if (system_backend_ && system_backend_->is_active()) system_backend_->Unregister(); }
}
} }
bool GlobalShortcutsManager::IsMacAccessibilityEnabled() const {
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
if (system_backend_) return qobject_cast<GlobalShortcutsBackendMacOS*>(system_backend_)->IsAccessibilityEnabled();
else return false; bool GlobalShortcutsManager::IsMacAccessibilityEnabled() {
#else
return true; return GlobalShortcutsBackendMacOS::IsAccessibilityEnabled();
#endif
} }
void GlobalShortcutsManager::ShowMacAccessibilityDialog() const { #endif // Q_OS_MACOS
void GlobalShortcutsManager::ShowMacAccessibilityDialog() {
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
if (system_backend_) qobject_cast<GlobalShortcutsBackendMacOS*>(system_backend_)->ShowAccessibilityDialog(); GlobalShortcutsBackendMacOS::ShowAccessibilityDialog();
#endif #endif
} }

View File

@@ -28,14 +28,16 @@
#include <QObject> #include <QObject>
#include <QWidget> #include <QWidget>
#include <QList>
#include <QMap> #include <QMap>
#include <QString> #include <QString>
#include <QKeySequence> #include <QKeySequence>
#include <QSettings> #include <QSettings>
#include "globalshortcutsbackend.h"
class QShortcut; class QShortcut;
class QAction; class QAction;
class GlobalShortcutsBackend;
class GlobalShortcutsManager : public QWidget { class GlobalShortcutsManager : public QWidget {
Q_OBJECT Q_OBJECT
@@ -51,18 +53,27 @@ class GlobalShortcutsManager : public QWidget {
}; };
QMap<QString, Shortcut> shortcuts() const { return shortcuts_; } QMap<QString, Shortcut> shortcuts() const { return shortcuts_; }
bool IsKdeAvailable() const;
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
static bool IsKdeAvailable();
static bool IsGnomeAvailable();
static bool IsMateAvailable();
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_X11_GLOBALSHORTCUTS
static bool IsX11Available(); static bool IsX11Available();
bool IsGnomeAvailable() const; #endif // HAVE_X11_GLOBALSHORTCUTS
bool IsMateAvailable() const;
bool IsMacAccessibilityEnabled() const; #ifdef Q_OS_MACOS
static bool IsMacAccessibilityEnabled();
#endif // Q_OS_MACOS
bool Register();
void Unregister();
public slots: public slots:
void ReloadSettings(); void ReloadSettings();
void ShowMacAccessibilityDialog() const; void ShowMacAccessibilityDialog();
void Unregister();
void Register();
signals: signals:
void Play(); void Play();
@@ -91,18 +102,10 @@ class GlobalShortcutsManager : public QWidget {
Shortcut AddShortcut(const QString &id, const QString &name, const QKeySequence &default_key); Shortcut AddShortcut(const QString &id, const QString &name, const QKeySequence &default_key);
private: private:
GlobalShortcutsBackend *kde_backend_; QList<GlobalShortcutsBackend*> backends_;
GlobalShortcutsBackend *gnome_backend_;
GlobalShortcutsBackend *mate_backend_;
GlobalShortcutsBackend *system_backend_;
QMap<QString, Shortcut> shortcuts_;
QSettings settings_; QSettings settings_;
QList<GlobalShortcutsBackend::Type> backends_enabled_;
bool use_kde_; QMap<QString, Shortcut> shortcuts_;
bool use_gnome_;
bool use_mate_;
bool use_x11_;
}; };
#endif // GLOBALSHORTCUTSMANAGER_H #endif // GLOBALSHORTCUTSMANAGER_H

View File

@@ -42,9 +42,6 @@
#include "core/iconloader.h" #include "core/iconloader.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/utilities.h" #include "core/utilities.h"
#ifdef Q_OS_MACOS
# include "core/mac_utilities.h"
#endif
#include "globalshortcuts/globalshortcutgrabber.h" #include "globalshortcuts/globalshortcutgrabber.h"
#include "globalshortcuts/globalshortcutsmanager.h" #include "globalshortcuts/globalshortcutsmanager.h"
#include "settingspage.h" #include "settingspage.h"
@@ -71,41 +68,32 @@ 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);
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
# ifdef HAVE_DBUS
QObject::connect(ui_->checkbox_kde, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged); QObject::connect(ui_->checkbox_kde, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
QObject::connect(ui_->checkbox_gnome, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged); QObject::connect(ui_->checkbox_gnome, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
QObject::connect(ui_->checkbox_mate, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged); QObject::connect(ui_->checkbox_mate, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
QObject::connect(ui_->button_gnome_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties); QObject::connect(ui_->button_gnome_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties);
QObject::connect(ui_->button_mate_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenMateKeybindingProperties); QObject::connect(ui_->button_mate_open, &QPushButton::clicked, this, &GlobalShortcutsSettingsPage::OpenMateKeybindingProperties);
# endif
# ifdef HAVE_X11_GLOBALSHORTCUTS
QObject::connect(ui_->checkbox_x11, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
# endif
#else #else
ui_->widget_kde->hide(); ui_->widget_kde->hide();
ui_->widget_gnome->hide(); ui_->widget_gnome->hide();
ui_->widget_mate->hide(); ui_->widget_mate->hide();
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_X11_GLOBALSHORTCUTS
QObject::connect(ui_->checkbox_x11, &QCheckBox::toggled, this, &GlobalShortcutsSettingsPage::ShortcutOptionsChanged);
#else
ui_->widget_x11->hide(); ui_->widget_x11->hide();
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) #endif // HAVE_X11_GLOBALSHORTCUTS
#ifndef Q_OS_MACOS
ui_->widget_macos_access->hide();
#endif // Q_OS_MACOS
} }
GlobalShortcutsSettingsPage::~GlobalShortcutsSettingsPage() { delete ui_; } GlobalShortcutsSettingsPage::~GlobalShortcutsSettingsPage() { delete ui_; }
bool GlobalShortcutsSettingsPage::IsEnabled() const {
#ifdef Q_OS_MACOS
qLog(Debug) << Utilities::GetMacOsVersion();
if (Utilities::GetMacOsVersion() < 6) { // Leopard and earlier.
return false;
}
#endif
return true;
}
void GlobalShortcutsSettingsPage::Load() { void GlobalShortcutsSettingsPage::Load() {
QSettings s; QSettings s;
@@ -119,10 +107,13 @@ void GlobalShortcutsSettingsPage::Load() {
de_ = Utilities::DesktopEnvironment(); de_ = Utilities::DesktopEnvironment();
ui_->widget_warning->hide(); ui_->widget_warning->hide();
QObject::connect(ui_->button_macos_open, &QPushButton::clicked, manager, &GlobalShortcutsManager::ShowMacAccessibilityDialog); #ifdef Q_OS_MACOS
QObject::connect(ui_->button_macos_preferences, &QPushButton::clicked, manager, &GlobalShortcutsManager::ShowMacAccessibilityDialog);
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
if (manager->IsKdeAvailable()) {
if (GlobalShortcutsManager::IsKdeAvailable()) {
qLog(Debug) << "KDE (KGlobalAccel) backend is available."; qLog(Debug) << "KDE (KGlobalAccel) backend is available.";
ui_->widget_kde->show(); ui_->widget_kde->show();
} }
@@ -131,7 +122,7 @@ void GlobalShortcutsSettingsPage::Load() {
ui_->widget_kde->hide(); ui_->widget_kde->hide();
} }
if (manager->IsGnomeAvailable()) { if (GlobalShortcutsManager::IsGnomeAvailable()) {
qLog(Debug) << "Gnome (GSD) backend is available."; qLog(Debug) << "Gnome (GSD) backend is available.";
ui_->widget_gnome->show(); ui_->widget_gnome->show();
} }
@@ -140,7 +131,7 @@ void GlobalShortcutsSettingsPage::Load() {
ui_->widget_gnome->hide(); ui_->widget_gnome->hide();
} }
if (manager->IsMateAvailable()) { if (GlobalShortcutsManager::IsMateAvailable()) {
qLog(Debug) << "MATE backend is available."; qLog(Debug) << "MATE backend is available.";
ui_->widget_mate->show(); ui_->widget_mate->show();
} }
@@ -149,7 +140,10 @@ void GlobalShortcutsSettingsPage::Load() {
ui_->widget_mate->hide(); ui_->widget_mate->hide();
} }
if (manager->IsX11Available()) { #endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_X11_GLOBALSHORTCUTS
if (GlobalShortcutsManager::IsX11Available()) {
qLog(Debug) << "X11 backend is available."; qLog(Debug) << "X11 backend is available.";
ui_->widget_x11->show(); ui_->widget_x11->show();
} }
@@ -157,7 +151,7 @@ void GlobalShortcutsSettingsPage::Load() {
qLog(Debug) << "X11 backend is unavailable."; qLog(Debug) << "X11 backend is unavailable.";
ui_->widget_x11->hide(); ui_->widget_x11->hide();
} }
#endif #endif // HAVE_X11_GLOBALSHORTCUTS
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager->shortcuts().values(); QList<GlobalShortcutsManager::Shortcut> shortcuts = manager->shortcuts().values();
for (const GlobalShortcutsManager::Shortcut &i : shortcuts) { for (const GlobalShortcutsManager::Shortcut &i : shortcuts) {
@@ -178,7 +172,7 @@ void GlobalShortcutsSettingsPage::Load() {
SetShortcut(shortcut.s.id, shortcut.s.action->shortcut()); SetShortcut(shortcut.s.id, shortcut.s.action->shortcut());
} }
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
if (ui_->widget_kde->isVisibleTo(this)) { if (ui_->widget_kde->isVisibleTo(this)) {
ui_->checkbox_kde->setChecked(s.value("use_kde", true).toBool()); ui_->checkbox_kde->setChecked(s.value("use_kde", true).toBool());
@@ -192,20 +186,20 @@ void GlobalShortcutsSettingsPage::Load() {
ui_->checkbox_mate->setChecked(s.value("use_mate", true).toBool()); ui_->checkbox_mate->setChecked(s.value("use_mate", true).toBool());
} }
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_X11_GLOBALSHORTCUTS
if (ui_->widget_x11->isVisibleTo(this)) { if (ui_->widget_x11->isVisibleTo(this)) {
ui_->checkbox_x11->setChecked(s.value("use_x11", false).toBool()); ui_->checkbox_x11->setChecked(s.value("use_x11", false).toBool());
} }
#endif #endif // HAVE_X11_GLOBALSHORTCUTS
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && (defined(HAVE_DBUS) || defined(HAVE_X11_GLOBALSHORTCUTS))
ShortcutOptionsChanged(); ShortcutOptionsChanged();
#endif #endif
ui_->widget_macos->setVisible(!manager->IsMacAccessibilityEnabled());
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
qint32 macos_version = Utilities::GetMacOsVersion(); ui_->widget_macos_access->setVisible(!GlobalShortcutsManager::IsMacAccessibilityEnabled());
ui_->label_macos->setVisible(macos_version < 9);
ui_->label_macos_mavericks->setVisible(macos_version >= 9);
#endif // Q_OS_MACOS #endif // Q_OS_MACOS
s.endGroup(); s.endGroup();
@@ -228,12 +222,15 @@ void GlobalShortcutsSettingsPage::Save() {
s.setValue(shortcut.s.id, shortcut.key.toString()); s.setValue(shortcut.s.id, shortcut.key.toString());
} }
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
s.setValue("use_kde", ui_->checkbox_kde->isChecked()); s.setValue("use_kde", ui_->checkbox_kde->isChecked());
s.setValue("use_gnome", ui_->checkbox_gnome->isChecked()); s.setValue("use_gnome", ui_->checkbox_gnome->isChecked());
s.setValue("use_mate", ui_->checkbox_mate->isChecked()); s.setValue("use_mate", ui_->checkbox_mate->isChecked());
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_X11_GLOBALSHORTCUTS
s.setValue("use_x11", ui_->checkbox_x11->isChecked()); s.setValue("use_x11", ui_->checkbox_x11->isChecked());
#endif #endif // HAVE_X11_GLOBALSHORTCUTS
s.endGroup(); s.endGroup();

View File

@@ -49,8 +49,6 @@ class GlobalShortcutsSettingsPage : public SettingsPage {
static const char *kSettingsGroup; static const char *kSettingsGroup;
bool IsEnabled() const override;
void Load() override; void Load() override;
void Save() override; void Save() override;

View File

@@ -156,6 +156,18 @@
<item> <item>
<widget class="QWidget" name="widget_warning" native="true"> <widget class="QWidget" name="widget_warning" native="true">
<layout class="QHBoxLayout" name="layout_warning"> <layout class="QHBoxLayout" name="layout_warning">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label_warn_icon"> <widget class="QLabel" name="label_warn_icon">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -210,11 +222,8 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget_macos" native="true"> <widget class="QWidget" name="widget_macos_access" native="true">
<layout class="QHBoxLayout" name="layout_macos"> <layout class="QHBoxLayout" name="layout_macos">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@@ -228,23 +237,41 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_macos"> <widget class="QLabel" name="label_macos_access_icon">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="minimumSize">
<string>You need to launch System Preferences and turn on &quot;&lt;span style=&quot; font-style:italic;&quot;&gt;Enable access for assistive devices&lt;/span&gt;&quot; to use global shortcuts in Strawberry.</string> <size>
<width>48</width>
<height>48</height>
</size>
</property> </property>
<property name="wordWrap"> <property name="maximumSize">
<bool>true</bool> <size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="baseSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../data/icons.qrc">:/icons/48x48/dialog-warning.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_macos_mavericks"> <widget class="QLabel" name="label_macos_access">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -260,7 +287,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="button_macos_open"> <widget class="QPushButton" name="button_macos_preferences">
<property name="text"> <property name="text">
<string>Open...</string> <string>Open...</string>
</property> </property>
@@ -360,7 +387,7 @@
<tabstop>checkbox_gnome</tabstop> <tabstop>checkbox_gnome</tabstop>
<tabstop>button_gnome_open</tabstop> <tabstop>button_gnome_open</tabstop>
<tabstop>checkbox_x11</tabstop> <tabstop>checkbox_x11</tabstop>
<tabstop>button_macos_open</tabstop> <tabstop>button_macos_preferences</tabstop>
<tabstop>list</tabstop> <tabstop>list</tabstop>
<tabstop>radio_none</tabstop> <tabstop>radio_none</tabstop>
<tabstop>radio_default</tabstop> <tabstop>radio_default</tabstop>