File indexing completed on 2024-05-12 17:07:15

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 
0012 #include "bindings.h"
0013 #include "keyboard_dbus.h"
0014 #include "layout_memory.h"
0015 #include "layoutnames.h"
0016 
0017 class XInputEventNotifier;
0018 class KeyboardConfig;
0019 struct Rules;
0020 
0021 class Q_DECL_EXPORT KeyboardDaemon : public KDEDModule
0022 {
0023     Q_OBJECT
0024     Q_CLASSINFO("D-Bus Interface", "org.kde.KeyboardLayouts")
0025 
0026     KeyboardConfig *keyboardConfig;
0027     KeyboardLayoutActionCollection *actionCollection;
0028     XInputEventNotifier *xEventNotifier;
0029     LayoutMemory layoutMemory;
0030     const Rules *rules;
0031 
0032     void registerListeners();
0033     void registerShortcut();
0034     void unregisterListeners();
0035     void unregisterShortcut();
0036 
0037 private Q_SLOTS:
0038     void configureKeyboard();
0039     void configureInput();
0040     void layoutChangedSlot();
0041     void layoutMapChanged();
0042     bool setLayout(QAction *action);
0043 
0044 public Q_SLOTS:
0045     Q_SCRIPTABLE void switchToNextLayout();
0046     Q_SCRIPTABLE void switchToPreviousLayout();
0047     Q_SCRIPTABLE bool setLayout(uint index);
0048     Q_SCRIPTABLE uint getLayout() const;
0049     Q_SCRIPTABLE QVector<LayoutNames> getLayoutsList() const;
0050 
0051 Q_SIGNALS:
0052     Q_SCRIPTABLE void layoutChanged(uint index);
0053     Q_SCRIPTABLE void layoutListChanged();
0054 
0055 public:
0056     KeyboardDaemon(QObject *parent, const QList<QVariant> &);
0057     ~KeyboardDaemon() override;
0058 };