File indexing completed on 2024-05-12 05:35:43
0001 /* 0002 SPDX-FileCopyrightText: 2010 Andriy Rysin <rysin@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <KDEDModule> 0010 #include <QStringList> 0011 #include <optional> 0012 0013 #include "bindings.h" 0014 #include "keyboard_dbus.h" 0015 #include "layout_memory.h" 0016 #include "layoutnames.h" 0017 0018 class XInputEventNotifier; 0019 class KeyboardConfig; 0020 struct Rules; 0021 0022 class Q_DECL_EXPORT KeyboardDaemon : public KDEDModule 0023 { 0024 Q_OBJECT 0025 Q_CLASSINFO("D-Bus Interface", "org.kde.KeyboardLayouts") 0026 0027 KeyboardConfig *keyboardConfig; 0028 KeyboardLayoutActionCollection *actionCollection; 0029 XInputEventNotifier *xEventNotifier; 0030 LayoutMemory layoutMemory; 0031 std::optional<uint> lastUsedLayout; 0032 const Rules *rules; 0033 0034 void registerListeners(); 0035 void registerShortcut(); 0036 void unregisterListeners(); 0037 void unregisterShortcut(); 0038 void setLastUsedLayoutValue(uint newValue); 0039 0040 private Q_SLOTS: 0041 void configureKeyboard(); 0042 void configureInput(); 0043 void layoutChangedSlot(); 0044 void layoutMapChanged(); 0045 bool setLayout(QAction *action); 0046 0047 public Q_SLOTS: 0048 Q_SCRIPTABLE void switchToNextLayout(); 0049 Q_SCRIPTABLE void switchToPreviousLayout(); 0050 Q_SCRIPTABLE bool setLayout(uint index); 0051 Q_SCRIPTABLE uint getLayout() const; 0052 Q_SCRIPTABLE QList<LayoutNames> getLayoutsList() const; 0053 0054 Q_SIGNALS: 0055 Q_SCRIPTABLE void layoutChanged(uint index); 0056 Q_SCRIPTABLE void layoutListChanged(); 0057 0058 public: 0059 KeyboardDaemon(QObject *parent, const QList<QVariant> &); 0060 ~KeyboardDaemon() override; 0061 };