1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef VIRTUALKEYBOARDSETTINGS_H |
5 | #define VIRTUALKEYBOARDSETTINGS_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtVirtualKeyboard/private/qvirtualkeyboardnamespace_p.h> |
19 | #include <QtQml/qqml.h> |
20 | #include <QtCore/private/qglobal_p.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | namespace QtVirtualKeyboard { |
24 | |
25 | class QQuickWordCandidateListSettings; |
26 | class QQuickVirtualKeyboardSettingsPrivate; |
27 | |
28 | class QQuickVirtualKeyboardSettings : public QObject |
29 | { |
30 | Q_OBJECT |
31 | Q_DECLARE_PRIVATE(QQuickVirtualKeyboardSettings) |
32 | Q_PROPERTY(QUrl style READ style NOTIFY styleChanged) |
33 | Q_PROPERTY(QUrl layoutPath READ layoutPath WRITE setLayoutPath NOTIFY layoutPathChanged) |
34 | Q_PROPERTY(QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged) |
35 | Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged) |
36 | Q_PROPERTY(QStringList availableLocales READ availableLocales NOTIFY availableLocalesChanged) |
37 | Q_PROPERTY(QStringList activeLocales READ activeLocales WRITE setActiveLocales NOTIFY activeLocalesChanged) |
38 | Q_PROPERTY(QQuickWordCandidateListSettings *wordCandidateList READ wordCandidateList CONSTANT) |
39 | Q_PROPERTY(bool fullScreenMode READ fullScreenMode WRITE setFullScreenMode NOTIFY fullScreenModeChanged) |
40 | Q_PROPERTY(QString userDataPath READ userDataPath WRITE setUserDataPath NOTIFY userDataPathChanged REVISION(6, 1)) |
41 | Q_PROPERTY(int hwrTimeoutForAlphabetic READ hwrTimeoutForAlphabetic WRITE setHwrTimeoutForAlphabetic NOTIFY hwrTimeoutForAlphabeticChanged REVISION(6, 1)) |
42 | Q_PROPERTY(int hwrTimeoutForCjk READ hwrTimeoutForCjk WRITE setHwrTimeoutForCjk NOTIFY hwrTimeoutForCjkChanged REVISION(6, 1)) |
43 | Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged REVISION(6, 1)) |
44 | Q_PROPERTY(bool handwritingModeDisabled READ isHandwritingModeDisabled WRITE setHandwritingModeDisabled NOTIFY handwritingModeDisabledChanged REVISION(6, 1)) |
45 | Q_PROPERTY(bool defaultInputMethodDisabled READ isDefaultInputMethodDisabled WRITE setDefaultInputMethodDisabled NOTIFY defaultInputMethodDisabledChanged REVISION(6, 1)) |
46 | Q_PROPERTY(bool defaultDictionaryDisabled READ isDefaultDictionaryDisabled WRITE setDefaultDictionaryDisabled NOTIFY defaultDictionaryDisabledChanged REVISION(6, 1)) |
47 | Q_PROPERTY(QtVirtualKeyboard::KeyboardFunctionKeys visibleFunctionKeys READ visibleFunctionKeys WRITE setVisibleFunctionKeys NOTIFY visibleFunctionKeysChanged REVISION(6, 6)) |
48 | QML_NAMED_ELEMENT(VirtualKeyboardSettings) |
49 | QML_SINGLETON |
50 | QML_ADDED_IN_VERSION(1, 0) |
51 | QML_EXTRA_VERSION(2, 0) |
52 | |
53 | explicit QQuickVirtualKeyboardSettings(QQmlEngine *engine, QObject *parent = nullptr); |
54 | |
55 | public: |
56 | static QQuickVirtualKeyboardSettings *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine); |
57 | QString style() const; |
58 | |
59 | QUrl layoutPath() const; |
60 | void setLayoutPath(const QUrl &layoutPath); |
61 | |
62 | QString styleName() const; |
63 | void setStyleName(const QString &styleName); |
64 | |
65 | QString locale() const; |
66 | void setLocale(const QString &locale); |
67 | |
68 | QStringList availableLocales() const; |
69 | |
70 | void setActiveLocales(const QStringList &activeLocales); |
71 | QStringList activeLocales() const; |
72 | |
73 | QQuickWordCandidateListSettings *wordCandidateList() const; |
74 | |
75 | bool fullScreenMode() const; |
76 | void setFullScreenMode(bool fullScreenMode); |
77 | |
78 | QString userDataPath() const; |
79 | void setUserDataPath(const QString &userDataPath); |
80 | |
81 | int hwrTimeoutForAlphabetic() const; |
82 | void setHwrTimeoutForAlphabetic(int hwrTimeoutForAlphabetic); |
83 | |
84 | int hwrTimeoutForCjk() const; |
85 | void setHwrTimeoutForCjk(int hwrTimeoutForCjk); |
86 | |
87 | Qt::InputMethodHints inputMethodHints() const; |
88 | void setInputMethodHints(const Qt::InputMethodHints &inputMethodHints); |
89 | |
90 | bool isHandwritingModeDisabled() const; |
91 | void setHandwritingModeDisabled(bool handwritingModeDisabled); |
92 | |
93 | bool isDefaultInputMethodDisabled() const; |
94 | void setDefaultInputMethodDisabled(bool defaultInputMethodDisabled); |
95 | |
96 | bool isDefaultDictionaryDisabled() const; |
97 | void setDefaultDictionaryDisabled(bool defaultDictionaryDisabled); |
98 | |
99 | QtVirtualKeyboard::KeyboardFunctionKeys visibleFunctionKeys() const; |
100 | void setVisibleFunctionKeys(QtVirtualKeyboard::KeyboardFunctionKeys newVisibleFunctionKeys); |
101 | |
102 | signals: |
103 | void styleChanged(); |
104 | void styleNameChanged(); |
105 | void localeChanged(); |
106 | void availableLocalesChanged(); |
107 | void activeLocalesChanged(); |
108 | void layoutPathChanged(); |
109 | void fullScreenModeChanged(); |
110 | Q_REVISION(6, 1) void userDataPathChanged(); |
111 | Q_REVISION(6, 1) void userDataReset(); |
112 | Q_REVISION(6, 1) void hwrTimeoutForAlphabeticChanged(); |
113 | Q_REVISION(6, 1) void hwrTimeoutForCjkChanged(); |
114 | Q_REVISION(6, 1) void inputMethodHintsChanged(); |
115 | Q_REVISION(6, 1) void handwritingModeDisabledChanged(); |
116 | Q_REVISION(6, 1) void defaultInputMethodDisabledChanged(); |
117 | Q_REVISION(6, 1) void defaultDictionaryDisabledChanged(); |
118 | Q_REVISION(6, 6) void visibleFunctionKeysChanged(); |
119 | |
120 | private: |
121 | void resetStyle(); |
122 | void resetLayoutPath(); |
123 | }; |
124 | |
125 | class QQuickWordCandidateListSettings : public QObject |
126 | { |
127 | Q_OBJECT |
128 | Q_PROPERTY(int autoHideDelay READ autoHideDelay WRITE setAutoHideDelay NOTIFY autoHideDelayChanged) |
129 | Q_PROPERTY(bool alwaysVisible READ alwaysVisible WRITE setAlwaysVisible NOTIFY alwaysVisibleChanged) |
130 | Q_PROPERTY(bool autoCommitWord READ autoCommitWord WRITE setAutoCommitWord NOTIFY autoCommitWordChanged) |
131 | QML_ANONYMOUS |
132 | |
133 | explicit QQuickWordCandidateListSettings(QObject *parent = nullptr); |
134 | friend class QQuickVirtualKeyboardSettingsPrivate; |
135 | |
136 | public: |
137 | int autoHideDelay() const; |
138 | void setAutoHideDelay(int autoHideDelay); |
139 | |
140 | bool alwaysVisible() const; |
141 | void setAlwaysVisible(bool alwaysVisible); |
142 | |
143 | bool autoCommitWord() const; |
144 | void setAutoCommitWord(bool autoCommitWord); |
145 | |
146 | signals: |
147 | void autoHideDelayChanged(); |
148 | void alwaysVisibleChanged(); |
149 | void autoCommitWordChanged(); |
150 | }; |
151 | |
152 | } // namespace QtVirtualKeyboard |
153 | QT_END_NAMESPACE |
154 | |
155 | #endif // VIRTUALKEYBOARDSETTINGS_H |
156 | |