Refactor CMake files

This commit is contained in:
Jonas Kvinge
2024-10-03 22:32:51 +02:00
parent 525ebbb9b7
commit 0768298b95
43 changed files with 1494 additions and 1768 deletions

View File

@@ -34,10 +34,16 @@
#include "globalshortcutsmanager.h"
#include "globalshortcutsbackend.h"
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
# include "globalshortcutsbackend-kde.h"
# include "globalshortcutsbackend-gnome.h"
# include "globalshortcutsbackend-mate.h"
#ifdef HAVE_KDE_GLOBALSHORTCUTS
#include "globalshortcutsbackend-kde.h"
#endif
#ifdef HAVE_GNOME_GLOBALSHORTCUTS
#include "globalshortcutsbackend-gnome.h"
#endif
#ifdef HAVE_MATE_GLOBALSHORTCUTS
#include "globalshortcutsbackend-mate.h"
#endif
#ifdef HAVE_X11_GLOBALSHORTCUTS
@@ -82,9 +88,15 @@ GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent) : QWidget(parent
// Create backends - these do the actual shortcut registration
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_KDE_GLOBALSHORTCUTS
backends_ << new GlobalShortcutsBackendKDE(this, this);
#endif
#ifdef HAVE_GNOME_GLOBALSHORTCUTS
backends_ << new GlobalShortcutsBackendGnome(this, this);
#endif
#ifdef HAVE_MATE_GLOBALSHORTCUTS
backends_ << new GlobalShortcutsBackendMate(this, this);
#endif
@@ -116,13 +128,19 @@ void GlobalShortcutsManager::ReloadSettings() {
backends_enabled_ << GlobalShortcutsBackend::Type::Win;
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_KDE_GLOBALSHORTCUTS
if (settings_.value("use_kde", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type::KDE;
}
#endif
#ifdef HAVE_GNOME_GLOBALSHORTCUTS
if (settings_.value("use_gnome", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type::Gnome;
}
#endif
#ifdef HAVE_MATE_GLOBALSHORTCUTS
if (settings_.value("use_mate", true).toBool()) {
backends_enabled_ << GlobalShortcutsBackend::Type::Mate;
}
@@ -165,7 +183,7 @@ GlobalShortcutsManager::Shortcut GlobalShortcutsManager::AddShortcut(const QStri
}
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#ifdef HAVE_KDE_GLOBALSHORTCUTS
bool GlobalShortcutsManager::IsKdeAvailable() {
@@ -173,19 +191,27 @@ bool GlobalShortcutsManager::IsKdeAvailable() {
}
#endif
#ifdef HAVE_KDE_GLOBALSHORTCUTS
bool GlobalShortcutsManager::IsGnomeAvailable() {
return GlobalShortcutsBackendGnome::IsGnomeAvailable();
}
#endif
#ifdef HAVE_KDE_GLOBALSHORTCUTS
bool GlobalShortcutsManager::IsMateAvailable() {
return GlobalShortcutsBackendMate::IsMateAvailable();
}
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
#endif
#ifdef HAVE_X11_GLOBALSHORTCUTS

View File

@@ -29,20 +29,12 @@
#define XK_XKB_KEYS
#define XK_LATIN1
#ifdef HAVE_KEYSYMDEF_H
# include <X11/keysymdef.h>
#else
# warning "Missing X11/keysymdef.h"
#endif
#ifdef HAVE_XF86KEYSYM_H
# include <X11/XF86keysym.h>
#endif
#include <X11/keysymdef.h>
#include <X11/XF86keysym.h>
namespace KeyMapperX11 {
static const QMap<Qt::Key, quint32> keymapper_x11_ = { // clazy:exclude=non-pod-global-static
#ifdef HAVE_KEYSYMDEF_H
{ Qt::Key_0, XK_0 },
{ Qt::Key_1, XK_1 },
{ Qt::Key_2, XK_2 },
@@ -208,9 +200,7 @@ static const QMap<Qt::Key, quint32> keymapper_x11_ = { // clazy:exclude=non-pod
{ Qt::Key_MultipleCandidate, XK_MultipleCandidate },
{ Qt::Key_PreviousCandidate, XK_PreviousCandidate },
{ Qt::Key_Mode_switch, XK_Mode_switch },
#endif
#ifdef HAVE_XF86KEYSYM_H
{ Qt::Key_Back, XF86XK_Back },
{ Qt::Key_Forward, XF86XK_Forward },
{ Qt::Key_Stop, XF86XK_Stop },
@@ -249,7 +239,6 @@ static const QMap<Qt::Key, quint32> keymapper_x11_ = { // clazy:exclude=non-pod
{ Qt::Key_LaunchF, XF86XK_LaunchD },
{ Qt::Key_LaunchG, XF86XK_LaunchE },
{ Qt::Key_LaunchH, XF86XK_LaunchF },
#endif
{Qt::Key(0), 0}

View File

@@ -0,0 +1,17 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.gnome.SettingsDaemon.MediaKeys">
<method name="ReleaseMediaPlayerKeys">
<arg name="application" type="s" direction="in"/>
</method>
<method name="GrabMediaPlayerKeys">
<arg name="application" type="s" direction="in"/>
<arg name="time" type="u" direction="in"/>
</method>
<signal name="MediaPlayerKeyPressed">
<arg type="s"/>
<arg type="s"/>
</signal>
</interface>
</node>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kglobalaccel.Component">
<property name="friendlyName" type="s" access="read"/>
<property name="uniqueName" type="s" access="read"/>
<signal name="globalShortcutPressed">
<arg name="componentUnique" type="s" direction="out"/>
<arg name="actionUnique" type="s" direction="out"/>
<arg name="timestamp" type="x" direction="out"/>
</signal>
<method name="cleanUp">
<arg type="b" direction="out"/>
</method>
<method name="isActive">
<arg type="b" direction="out"/>
</method>
<method name="shortcutNames">
<arg type="as" direction="out"/>
<arg name="context" type="s" direction="in"/>
</method>
<method name="shortcutNames">
<arg type="as" direction="out"/>
</method>
<method name="getShortcutContexts">
<arg type="as" direction="out"/>
</method>
<method name="invokeShortcut">
<arg name="actionName" type="s" direction="in"/>
</method>
</interface>
</node>

View File

@@ -0,0 +1,71 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.KGlobalAccel">
<signal name="yourShortcutGotChanged">
<arg name="actionId" type="as" direction="out"/>
<arg name="newKeys" type="ai" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QList&lt;int&gt;"/>
</signal>
<method name="allComponents">
<arg type="ao" direction="out"/>
</method>
<method name="allMainComponents">
<arg type="aas" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;QStringList&gt;"/>
</method>
<method name="allActionsForComponent">
<arg type="aas" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;QStringList&gt;"/>
<arg name="actionId" type="as" direction="in"/>
</method>
<method name="action">
<arg type="as" direction="out"/>
<arg name="key" type="i" direction="in"/>
</method>
<method name="getComponent">
<arg type="o" direction="out"/>
<arg name="componentUnique" type="s" direction="in"/>
</method>
<method name="shortcut">
<arg type="ai" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
<arg name="actionId" type="as" direction="in"/>
</method>
<method name="defaultShortcut">
<arg type="ai" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
<arg name="actionId" type="as" direction="in"/>
</method>
<method name="setShortcut">
<arg type="ai" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
<arg name="actionId" type="as" direction="in"/>
<arg name="keys" type="ai" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QList&lt;int&gt;"/>
<arg name="flags" type="u" direction="in"/>
</method>
<method name="setForeignShortcut">
<arg name="actionId" type="as" direction="in"/>
<arg name="keys" type="ai" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QList&lt;int&gt;"/>
</method>
<method name="setInactive">
<arg name="actionId" type="as" direction="in"/>
</method>
<method name="doRegister">
<arg name="actionId" type="as" direction="in"/>
</method>
<method name="unRegister">
<arg name="actionId" type="as" direction="in"/>
</method>
<method name="activateGlobalShortcutContext">
<arg name="component" type="s" direction="in"/>
<arg name="context" type="s" direction="in"/>
</method>
<method name="isGlobalShortcutAvailable">
<arg type="b" direction="out"/>
<arg name="key" type="i" direction="in"/>
<arg name="component" type="s" direction="in"/>
</method>
</interface>
</node>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.mate.SettingsDaemon.MediaKeys">
<method name="ReleaseMediaPlayerKeys">
<arg name="application" type="s" direction="in"/>
</method>
<method name="GrabMediaPlayerKeys">
<arg name="application" type="s" direction="in"/>
<arg name="time" type="u" direction="in"/>
</method>
<signal name="MediaPlayerKeyPressed">
<arg type="s"/>
<arg type="s"/>
</signal>
</interface>
</node>