You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.2 KiB
53 lines
1.2 KiB
/* |
|
SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com> |
|
SPDX-FileCopyrightText: 2020 Andrey Butirsky <butirsky@gmail.com> |
|
SPDX-License-Identifier: LGPL-2.1-or-later |
|
*/ |
|
|
|
#pragma once |
|
|
|
#include <QDBusReply> |
|
|
|
#include "debug.h" |
|
|
|
class OrgKdeKeyboardLayoutsInterface; |
|
class LayoutNames; |
|
|
|
class KeyboardLayout : public QObject |
|
{ |
|
Q_OBJECT |
|
|
|
Q_PROPERTY(uint layout MEMBER mLayout WRITE setLayout NOTIFY layoutChanged) |
|
|
|
Q_PROPERTY(const QVector<LayoutNames> &layoutsList READ getLayoutsList NOTIFY layoutsListChanged) |
|
|
|
public: |
|
explicit KeyboardLayout(QObject *parent = nullptr); |
|
~KeyboardLayout() override; |
|
|
|
Q_SIGNALS: |
|
void layoutChanged(); |
|
void layoutsListChanged(); |
|
|
|
protected: |
|
Q_INVOKABLE void switchToNextLayout(); |
|
Q_INVOKABLE void switchToPreviousLayout(); |
|
|
|
private: |
|
void setLayout(uint index); |
|
const QVector<LayoutNames> &getLayoutsList() const |
|
{ |
|
return mLayoutsList; |
|
} |
|
|
|
enum DBusData { Layout, LayoutsList }; |
|
|
|
template<class T> |
|
void requestDBusData(QDBusPendingReply<T> pendingReply, T &out, void (KeyboardLayout::*notify)()); |
|
template<DBusData> |
|
void requestDBusData(); |
|
|
|
uint mLayout; |
|
QVector<LayoutNames> mLayoutsList; |
|
OrgKdeKeyboardLayoutsInterface *mIface; |
|
};
|
|
|